public static PrintingConfig <TOwner> WithCulture <TOwner> (this PropertySerializationConfig <TOwner, int> config, CultureInfo culture) { return(new PrintingConfig <TOwner>((config as IPropertySerializationConfig <TOwner>).ParentConfig) .WithDefaultTypeRule( typeof(int), x => ((int)x).ToString(culture))); }
public static PrintingConfig <TOwner> Trim <TOwner>(this PropertySerializationConfig <TOwner, string> config, int length) { ((config as IPropertySerializingConfig <TOwner>).ParentConfig as IPrintingConfig) .SerializationInfo.AddTrimRule((config as IPropertySerializingConfig <TOwner>).CurrentName, length); return((config as IPropertySerializingConfig <TOwner>).ParentConfig); }
public static PrintingConfig <TOwner> WithCulture <TOwner, TPropType> (this PropertySerializationConfig <TOwner, TPropType> config, CultureInfo culture) where TPropType : IFormattable { ((config as IPropertySerializingConfig <TOwner>).ParentConfig as IPrintingConfig) .SerializationInfo.AddCultureRule(typeof(TPropType), culture); return((config as IPropertySerializingConfig <TOwner>).ParentConfig); }
public static PrintingConfig <TOwner> Trim <TOwner>(this PropertySerializationConfig <TOwner, string> config, int length) { if (length < 0) { throw new ArgumentOutOfRangeException(); } return(new PrintingConfig <TOwner>((config as IPropertySerializationConfig <TOwner>).ParentConfig) .WithDefaultTypeRule( typeof(string), x => { var str = (string)x; return str.Substring(0, length > str.Length ? str.Length : length); })); }