Closed muradsun closed 3 years ago
@muradsun can you please provide all code for your example? In the code you provided you declare 2 classes object1 and object2, then you use these class names as variable names. How _comparer variable was initialized?
Try this
Class object1 { int? numericManagerId = null } Class object2 { int? numericManagerId = 120 }
var matched = _comparer.Compare(object1, object2, out var differences); var y = differences.ToList().Count();
Bellow Error will popup: System.InvalidCastException HResult=0x80004002 Message=Unable to cast object of type 'System.Int32' to type 'System.String'. Source=System.Private.CoreLib StackTrace: at System.Runtime.CompilerServices.CastHelpers.ChkCastAny(Void* toTypeHnd, Object obj) at ObjectsComparer.AbstractValueComparerd__4.MoveNext()
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
.
.
.
.
1.Compare(Object obj1, Object obj2, ComparisonSettings settings) at ObjectsComparer.Comparer
1.