public PerformCompareProperties ( CompareParms parms ) : void | ||
parms | CompareParms | |
리턴 | void |
private void CompareProperties(CompareParms parms) { if (parms.Config.CompareProperties) { _propertyComparer.PerformCompareProperties(parms, true); } }
/// <summary> /// Compare two structs /// </summary> public override void CompareType(CompareParms parms) { if (parms.Result.CurrentStructDepth >= parms.Config.MaxStructDepth) { return; } try { parms.Result.CurrentStructDepth++; parms.Object1Type = parms.Object1.GetType(); parms.Object2Type = parms.Object2.GetType(); if (parms.Config.CompareFields) { _fieldComparer.PerformCompareFields(parms); } if (parms.Config.CompareProperties) { _propertyComparer.PerformCompareProperties(parms); } } finally { parms.Result.CurrentStructDepth--; } }
/// <summary> /// Compare two classes /// </summary> public override void CompareType(CompareParms parms) { try { parms.Result.AddParent(parms.Object1); parms.Result.AddParent(parms.Object2); //Custom classes that implement IEnumerable may have the same hash code //Ignore objects with the same hash code if (!(parms.Object1 is IEnumerable) && ReferenceEquals(parms.Object1, parms.Object2)) { return; } Type t1 = parms.Object1.GetType(); Type t2 = parms.Object2.GetType(); //Check if the class type should be excluded based on the configuration if (ExcludeLogic.ShouldExcludeClass(parms.Config, t1, t2)) { return; } parms.Object1Type = t1; parms.Object2Type = t2; //Compare the properties if (parms.Config.CompareProperties) { _propertyComparer.PerformCompareProperties(parms); } //Compare the fields if (parms.Config.CompareFields) { _fieldComparer.PerformCompareFields(parms); } } finally { parms.Result.RemoveParent(parms.Object1); parms.Result.RemoveParent(parms.Object2); } }