コード例 #1
0
 /// <summary>
 /// Creates a key comparer.
 /// </summary>
 /// <typeparam name="TKey">The type of key objects being compared.</typeparam>
 /// <param name="selector">The key selector. May not be <c>null</c>.</param>
 /// <param name="keyComparer">The key comparer. Defaults to <c>null</c>. If this is <c>null</c>, the default comparer is used.</param>
 /// <param name="allowNulls">A value indicating whether <c>null</c> values are passed to <paramref name="selector"/>. If <c>false</c>, then <c>null</c> values are considered less than any non-<c>null</c> values and are not passed to <paramref name="selector"/>.</param>
 /// <returns>A key comparer.</returns>
 public IEqualityComparer <T> EquateBy <TKey>(Func <T, TKey> selector, IEqualityComparer <TKey> keyComparer = null, bool allowNulls = false)
 {
     Contract.Requires(selector != null);
     Contract.Ensures(Contract.Result <IEqualityComparer <T> >() != null);
     return(EqualityCompare <T> .EquateBy(selector, keyComparer, allowNulls));
 }
コード例 #2
0
 /// <summary>
 /// Gets the default equality comparer for this type.
 /// </summary>
 public IEqualityComparer <T> Default()
 {
     Contract.Ensures(Contract.Result <IEqualityComparer <T> >() != null);
     return(EqualityCompare <T> .Default());
 }
コード例 #3
0
 /// <summary>
 /// Gets the reference equality comparer for this type.
 /// </summary>
 public IEqualityComparer <T> Reference()
 {
     Contract.Ensures(Contract.Result <IEqualityComparer <T> >() != null);
     return(EqualityCompare <T> .Reference());
 }
コード例 #4
0
 /// <summary>
 /// Gets the null equality comparer for this type, which evaluates all objects as equivalent.
 /// </summary>
 public IFullEqualityComparer <T> Null()
 {
     Contract.Ensures(Contract.Result <IEqualityComparer <T> >() != null);
     return(EqualityCompare <T> .Null());
 }