public static IEnumerable <Walker.Tuple> Differing(Type type, object source, object target, IEnumerable <string> includeFields, IEnumerable <string> excludeFields) { if (excludeFields != null) { excludeFields = excludeFields.AsArray(); } if (includeFields != null) { includeFields = includeFields.AsArray(); } #if DEBUG // perf hit, but useful for debugging ReportInvalidProperties(type, excludeFields); ReportInvalidProperties(type, includeFields); #endif var differing = Walker.GoLightweight(type, source, target, x => { if (!x.CanWrite) { return(false); } if (includeFields != null && !includeFields.Contains(x.Name)) { return(false); } if (excludeFields != null && excludeFields.Contains(x.Name)) { return(false); } return(true); }); foreach (var i in differing) { var s = i.sourceValue; var t = i.targetValue; if (s == t) { continue; } else if (s == null || t == null) { yield return(i); } else if (!s.Equals(t)) { yield return(i); } } }