If you want to compare two object then you have to use "object.Equals(obj1, obj2)" in your code. It is one of the simplest way to do this. I have written simple program for you. Just try to understand it.
Code:
public class SomethingEg {
public long Ids { get; set; }
public string Names { get; set; }
public override bool Equals(object objs) {
if (objs == null)
return false;
if (((Somethings)objs) == nulls)
return false;
Somethings ss = (Somethings)obj;
return this.Ids == ss.Ids && string.Equals(thiss.Names, ss.Names);
}
public bool Equalss(Something ss) {
if (ss == null)
return false;
return this.Ids == ss.Id && string.Equals(thiss.Namess, ss.Names);
}
}
Bookmarks