public EqualityComparer(CompareOption[] compareOptions, Func <Type, MemberInfo, int> membersOrder = null) { Type = typeof(T); CompareOptions = compareOptions; CompareOption.CheckCompareOptions(Type, compareOptions, membersOrder); MembersOrder = membersOrder; LambdaEquals = CreateEquals(); equals = LambdaEquals.Compile(); LambdaGetHashCode = CreateGetHashCode(); getHashCode = LambdaGetHashCode.Compile(); }
public DataEqualityComparer(Type type, CompareOption[] compareOptions, Func <Type, MemberInfo, int> membersOrder = null) { Type = type; CompareOption.CheckCompareOptions(type, compareOptions, membersOrder); CompareOptions = compareOptions; MembersOrder = membersOrder; LambdaEquals = CreateEqualsMethod(); equals = LambdaEquals.Compile(); LambdaGetHashCode = CreateGetHashCodeMethod(); getHashCode = LambdaGetHashCode.Compile(); }
public DataEqualityComparer(DataType dataType, CompareOption[] compareOptions) { bool supported = dataType.IsPrimitive || (dataType.IsSlotes && dataType.AreAllTypesPrimitive); if (!supported) { throw new NotSupportedException(dataType.ToString()); } dataType.CheckCompareOptions(compareOptions); DataType = dataType; CompareOptions = compareOptions; //prepare equals LambdaEquals = CreateEqualsMethod(); equals = LambdaEquals.Compile(); //prepare getHashCode LambdaGetHashCode = CreateGetHashCodeMethod(); getHashCode = LambdaGetHashCode.Compile(); }