public bool Equals(User other) { //Check whether the compared object is null. if (Object.ReferenceEquals(other, null)) { return(false); } //Check whether the compared object references the same data. if (Object.ReferenceEquals(this, other)) { return(true); } //Check whether the properties are equal. return(SamAccountName.Equals(other.SamAccountName)); }