Interface, which defines a generalized method that a value type or class implements to create a type-specific method for determining equality of instances.
Questions tagged [iequatable]
165 questions
0
votes
0 answers
What "gotchas" should I be aware of when using Resharper to generate the IEquatable interface?
I've generated the following code using Resharper. I'm wondering if its good as it is, or if there are problems I need to fix/be aware of.
I'm wondering about the comparison for m_customTRP. m_customTRP is an IList, the TimeRfPower also…

Miebster
- 2,365
- 4
- 21
- 27
0
votes
0 answers
What is the proper way to implement Equation functions
There seem to be a lot of equation interfaces: IEquatable, IEquatable, IEqualityComparer, IEqualityComparer. Which one should I implement to be able to detect if two objects have the same value (while my object decides what the same value…

Harald Coppoolse
- 28,834
- 7
- 67
- 116
0
votes
2 answers
Comparing a List with another List
I have been reading on how to compare a list with one annother. I have tried to implement the IEquatable interface. Here is what i have done so far:
///
/// A object holder that contains a service and its current failcount
///…

Zapnologica
- 22,170
- 44
- 158
- 253
0
votes
2 answers
Using IEquatable Equals, comparing property of objects in array
I'm attempting to make a flush in a classic poker/card game type program. The property is the suit (hearts, diamonds, etc) and the array is the hand. I used the IEquatable and implemented the Equals method
public bool Equals(SuperCard…

jacksonSD
- 677
- 2
- 13
- 27
0
votes
1 answer
How do I implement equality for an abstract base class?
I'm following the MSDN guidance for value equality, and I found a case that the documentation didn't cover, equality for a base class.
A little background:
I'm working on a Mahjong game (4-player, not matching), and I'm working on defining the…

Christopher Stevenson
- 2,843
- 20
- 25
0
votes
2 answers
How to step into an interface method (Equals)
I've implemented the iEquatable interface:
LineItem : IEquatable
But now I want to debug my Equals(...) method by stepping through the code. But even in debug mode, stepping in doesn't go into it (i.e. F11), and putting a breakpoint…

Dan
- 45,079
- 17
- 88
- 157
0
votes
1 answer
Comparison of Objects (Multiple Levels)
I want to create objects with 5 properties and each properties has 2 attributes. After that, I compare the objects if they are same, they will be grouped in same category.
Here is the code:
Item.cs
public class Item
{
public Item()
{
…

king jia
- 692
- 8
- 20
- 43
0
votes
2 answers
Compare Objects' properties using hashcode
I need to know the ways to compare many objects using hashcode. So here is one of the class.
public class Test: IEquatable
{
public Test()
{
}
public string ID { get; set; }
public string Name{ get; set; }
public…

king jia
- 692
- 8
- 20
- 43
0
votes
1 answer
VB.Net IEquatable, Access Denied
I just have a simple Interface definition in my project, which I haven't even used yet. But when I try to build the project I get this error:
Access is denied: 'System.IEquatable`1[Reactor.IOptions]'.
Below is the interface:
Interface…

Kratz
- 4,280
- 3
- 32
- 55
0
votes
1 answer
Determining if any elements in an IEnumerable could be cast to type U
In newer versions of .net, there are a number of extensions methods which accept IEnumerable or IEnumerable. One such method is OfType which returns an enumerable that contains only elements of the original sequence which can be cast to…

supercat
- 77,689
- 9
- 166
- 211
-1
votes
1 answer
How to find the differences between two objects using IEquatable?
I am comparing two same objects by implementing an IEquatable interface on the object. If they are not equal, then update the DB; otherwise, leave it as it is. Here the context is i need to update the table with the data coming from an excel sheet…

Glory Raj
- 17,397
- 27
- 100
- 203
-1
votes
2 answers
IEquatable and inheritance
How would I make one parent and one child and inherit the IEquatable function for the child? here is my code
public class Category : IEquatable
{
public string _Name { get; set; }
public string _Id { get; set;}
private string…
user13319447
-1
votes
1 answer
"There is no implicit reference conversion from 'object' to 'System.IEquatable
I got this error:
There is no implicit reference conversion from object to System.IEquatable

Shashank Hegde
- 15
- 4
-1
votes
3 answers
What interfaces must I implement to make a List or Dictionary concatenate two values as a key
I need to make my custom object work correctly in a Dictionary, List, etc... so that I can change properties of the object, and allow it to be resorted, and not orphaned.
The last time I attempted overriding GetHashCode(), I orphaned objects when I…

makerofthings7
- 60,103
- 53
- 215
- 448
-2
votes
4 answers
Equals, GetHashCode and Operators override not being called in IEquatable implementation
I'm trying to implement IEqueatable so I could use .Except in my custom type LINQ queries.
The custom type code looks like this:
public class Case : IEquatable
{
[Key]
public int Id { get; set; }
//More…

RainierMallol
- 806
- 1
- 8
- 24