Top "Iequatable" questions

Interface, which defines a generalized method that a value type or class implements to create a type-specific method for determining equality of instances.

Distinct not working with LINQ to Objects

class Program { static void Main(string[] args) { List<Book> books = new List<Book> { new Book { Name="…

c# .net linq iequatable iequalitycomparer
What's the difference between IEquatable and just overriding Object.Equals()?

I want my Food class to be able to test whenever it is equal to another instance of Food. I …

c# .net equals equality iequatable
What is the difference between IEqualityComparer<T> and IEquatable<T>?

I want to understand the scenarios where IEqualityComparer<T> and IEquatable<T> should be used. The …

c# .net equals iequalitycomparer iequatable
When To Use IEquatable<T> And Why

What does IEquatable<T> buy you, exactly? The only reason I can see it being useful is when …

c# iequatable
Is there a complete IEquatable implementation reference?

Many of my questions here on SO concerns IEquatable implementation. I found it being extremely difficult to implement correctly, because …

c# .net equals gethashcode iequatable
What should GetHashCode return when object's identifier is null?

Which of the following is correct/better, considering that identity property could be null. public override int GetHashCode() { if (ID == …

c# gethashcode iequatable
What's the difference between IComparable & IEquatable interfaces?

both the interfaces seem to compare objects for equality, so what's the major differences between them?

c# interface icomparable iequatable
Howto override List<T> Contains

I want to compare a property instead of the entire object using a List[MyObject]. I therefore use IEquatable[MyObject] …

c# generics contains iequatable
Linq .Except function "At least one object must implement IComparable."

Basically i have a container which implements IEquatable (sample shown below) public class ContainerClass : IEquatable<ContainerClass> { public IEnumerable&…

c# linq iequatable
GetHashCode on null fields?

How do I deal with null fields in GetHashCode function? Module Module1 Sub Main() Dim c As New Contact Dim …

null nullreferenceexception equality gethashcode iequatable