public override bool Equals(object obj) { Ayarlar ayar = obj as Ayarlar; if (ayar == null) { return(false); } return((ayar != null) // 1) Object is not null. // 2) Object is of same Type. && (MatchingIds(ayar) || MatchingHashCodes(ayar))); // 3) Ids or Hashcodes match. }
private bool MatchingIds(Ayarlar obj) { return((this.Ad != null && !this.Ad.Equals(default(string))) && // 1) this.Id is not null/default. (obj.Ad != null && !obj.Ad.Equals(default(string))) && // 1.5) obj.Id is not null/default. (this.Ad.Equals(obj.Ad) && this.SubeKodu.Equals(obj.SubeKodu))); // 2) Ids match. }