コード例 #1
0
 public static PrintingConfig <TOwner> TrimmedToLength <TOwner>(
     this MemberPrintingConfig <TOwner, string> propConfig, int maxLength)
 {
     return(propConfig.SetSerializer(str => str.Substring(0, Math.Min(str.Length, maxLength))));
 }
コード例 #2
0
 public static PrintingConfig <TOwner> SetCulture <TOwner, TProperty>(
     this MemberPrintingConfig <TOwner, TProperty> propConfig, CultureInfo culture)
     where TProperty : IFormattable
 {
     return(propConfig.SetSerializer(x => ((IFormattable)x).ToString("N", culture)));
 }