public bool Equals(AnonymousType1 other) { if (ReferenceEquals(other, null)) { return(false); } return(Department == other.Department && Gender == other.Gender); }
public void equals_works() { var t1 = new AnonymousType1 <string>("t1"); var t2 = new AnonymousType1 <string>("t1"); var t3 = new AnonymousType1 <string>("different"); Assert.True(t1.Equals(t2)); Assert.Equal(t1.GetHashCode(), t2.GetHashCode()); Assert.False(t1.Equals(null)); Assert.False(t1.Equals(t3)); }