SFML community forums

Bindings - other languages => DotNet => Topic started by: FRex on May 25, 2014, 04:35:52 am

Title: Is Color equality right?
Post by: FRex on May 25, 2014, 04:35:52 am
This line looks very weird to me even though I don't really know C#:
https://github.com/SFML/SFML.Net/blob/master/src/Graphics/Color.cs#L81
Isn't it always true if obj is a color?
shouldn't it instead read one of these or similar?
return (obj is Color) && Equals(obj as Color);
return (obj is Color) && Equals((Color)obj);
Title: Re: Is Color equality right?
Post by: Laurent on May 25, 2014, 11:13:38 am
You're right. Another possibility:

return (obj is Color) && obj.Equals(this);
Title: Re: Is Color equality right?
Post by: Deathbeam on May 25, 2014, 12:15:25 pm
Oh yea, sorry, my mistake, I forgot to put obj. before Equals(this), I will correct it.