public static PrintingConfig <TOwner> UsingCulture <TOwner, T>( this MemberPrintingConfig <TOwner, T> propConfig, CultureInfo culture) where T : IFormattable { return(propConfig.Using(x => x.ToString(null, culture))); }
public static PrintingConfig <TOwner> TrimmedToLength <TOwner>( this MemberPrintingConfig <TOwner, string> propConfig, int maxLength) { if (maxLength < 0) { throw new ArgumentException("maxLength must be non-negative"); } return(propConfig.Using(s => maxLength > s.Length ? s : s.Substring(0, maxLength))); }
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)))); }
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))); }