コード例 #1
0
ファイル: MemberSettings.cs プロジェクト: forki/Gu.State
 /// <summary>Try get a custom copyer for <paramref name="type"/></summary>
 /// <param name="type">The type.</param>
 /// <param name="copyer">The copyer.</param>
 /// <returns>True if a custom copyer is provided for <paramref name="type"/></returns>
 public bool TryGetCopyer(Type type, out CustomCopy copyer)
 {
     copyer = null;
     return(this.copyers?.TryGetValue(type, out copyer) == true);
 }
コード例 #2
0
 /// <summary>Provide a custom copy implementation for <typeparamref name="T"/>.</summary>
 /// <typeparam name="T">The type to copy.</typeparam>
 /// <param name="copyMethod">
 /// This method gets passed the source value, target value and returns the updated target value or a new target value.
 /// </param>
 /// <returns>Self.</returns>
 public PropertiesSettingsBuilder AddCustomCopy <T>(Func <T, T, T> copyMethod)
 {
     this.copyers[typeof(T)] = CustomCopy.Create(copyMethod);
     return(this);
 }