コード例 #1
0
ファイル: MemberSettings.cs プロジェクト: forki/Gu.State
 /// <summary>Try get a custom comparer for <paramref name="type"/></summary>
 /// <param name="type">The type.</param>
 /// <param name="comparer">The comparer.</param>
 /// <returns>True if a custom comparer is provided for <paramref name="type"/></returns>
 public bool TryGetComparer(Type type, out CastingComparer comparer)
 {
     comparer = null;
     return(this.comparers?.TryGetValue(type, out comparer) == true);
 }
コード例 #2
0
 /// <summary>Add a custom comparer for type <typeparamref name="T"/> in the setting.</summary>
 /// <typeparam name="T">The type.</typeparam>
 /// <returns>The builder instance for chaining.</returns>
 public PropertiesSettingsBuilder AddComparer <T>(IEqualityComparer <T> comparer)
 {
     this.comparers[typeof(T)] = CastingComparer.Create(comparer);
     return(this);
 }