I have a entity list. The entity has two integer variables. I’m trying to check if the list contains that identity but it always returns false.
Basically I’m trying to check if list contains X in any second indices.
List<Entity.Limit> list = new List<Entity.Limit>();
list.Add(new Entity.Limit(1, 2));
list.Add(new Entity.Limit(1, 3));
list.Add(new Entity.Limit(1, 4));
Response.Write(list.Contains(new Entity.Limit(1, 2))); //Returns False
Have
Entity.LimitoverrideObject.Equals. Right now, it’s comparing references, and so not matching any of them. So:Then
Contains()will be able to compare your objects properly.