📅  最后修改于: 2022-03-11 14:49:07.302000             🧑  作者: Mango
// Add the IEquatable interface to your class
public class MyObject : IEquatable
{
public string ID { get; set; }
public override bool Equals(object obj) { return base.Equals(obj); }
public bool Equals(MyObject other)
{
if (other == null) return false;
return
(object.ReferenceEquals(this.ID, other.ID) ||
this.ID != null && this.ID.Equals(other.ID)) &&
//... Do the above to all your paramters
}
}