/// <summary> /// Initializes a new instance of the <see cref="CompoundComparer<T>"/> class. /// </summary> /// <param name="source">The source comparer. If this is <c>null</c>, the default comparer is used.</param> /// <param name="secondSource">The second comparer. If this is <c>null</c>, the default comparer is used.</param> public CompoundComparer(IComparer <T>?source, IComparer <T>?secondSource) : base(source, null, true) { _secondSource = ComparerHelpers.NormalizeDefault(secondSource); _secondSourceGetHashCode = ComparerHelpers.ComparerGetHashCode(_secondSource); }
/// <summary> /// Initializes a new instance of the <see cref="SourceComparerBase<T, TSource>"/> class. /// </summary> /// <param name="source">The source comparer. If this is <c>null</c>, the default comparer is used.</param> /// <param name="getHashCode">The <c>GetHashCode</c> implementation to use. If this is <c>null</c>, this type will attempt to find <c>GetHashCode</c> on <paramref name="source"/>; if none is found, throws an exception.</param> /// <param name="specialNullHandling">A value indicating whether <c>null</c> values are passed to <see cref="EqualityComparerBase{T}.DoGetHashCode"/> and <see cref="ComparerBase{T}.DoCompare"/>. If <c>false</c>, then <c>null</c> values are considered less than any non-<c>null</c> values and are not passed to <see cref="EqualityComparerBase{T}.DoGetHashCode"/> nor <see cref="ComparerBase{T}.DoCompare"/>. This value is ignored if <typeparamref name="T"/> is a non-nullable type.</param> protected SourceComparerBase(IComparer <TSource>?source, Func <TSource, int>?getHashCode, bool specialNullHandling) : base(specialNullHandling) { Source = ComparerHelpers.NormalizeDefault(source); SourceGetHashCode = getHashCode ?? ComparerHelpers.ComparerGetHashCode(Source); }