public override bool Equals(object obj) { var a = this; var b = obj as ExampleClass; return(new Func <bool>[] { () => a.text == b.text, () => Cmp.Do(a, b, s => s.list, (x, y) => x.SequenceEqual(y)), () => Cmp.Do(a, b, s => s.dictionary, (x, y) => x.SequenceEqual(y)), () => Cmp.Do(a, b, s => s.dictionaryWithList, (x, y) => x.Zip(y, (t, v) => t.Key == v.Key && t.Value.SequenceEqual(v.Value) ).All(p => p) ), () => Cmp.Do(a, b, s => s.dictionaryWithListNested, (x, y) => x.Zip(y, (t, v) => t.Key == v.Key && t.Value.Zip(v.Value, (e, r) => Cmp.Do(e, r, q => q) ).All(l => l) ).All(p => p)), () => Cmp.Do(a, b, s => s.inheritedList), //() => a.inheritedList.Equals(b.inheritedList), () => Cmp.Do(a, b, s => s.inheritedDictionary), //() => a.inheritedDictionary.Equals(b.inheritedDictionary), () => Cmp.Do(a, b, s => s.nested), //() => a.nested == b.nested, () => Cmp.DoVal(a, b, s => s.nestedStruct) //() => a.nestedStruct.Equals(b.nestedStruct) } .All(t => t())); }
public override bool Equals(object obj) { var a = this; var b = (ExampleStruct)obj; return(a.number == b.number && a.text == b.text && Cmp.Do(a, b, (s) => s.nestedClass)); }