コード例 #1
0
 public static PrintingConfig <TOwner> Using <TOwner>(this PropertyPrintingConfig <TOwner, long> propConfig,
                                                      CultureInfo cultureInfo)
 {
     ((IPrintingConfig <TOwner>)((IPropertyPrintingConfig <TOwner, long>)propConfig).ParentConfig)
     .AddTypeCulture(typeof(long), cultureInfo);
     return(((IPropertyPrintingConfig <TOwner, long>)propConfig).ParentConfig);
 }
コード例 #2
0
        public static PrintingConfig <TOwner> TrimmedToLength <TOwner>(this PropertyPrintingConfig <TOwner, string> propConfig,
                                                                       int maxLen)
        {
            IPropertyPrintingConfig <TOwner, string> propertyConfig = propConfig;

            if (string.IsNullOrWhiteSpace(propertyConfig.PropName))
            {
                ((IPrintingConfig <TOwner>)propertyConfig.ParentConfig).SetAverageStringLength(maxLen);
            }
            else
            {
                ((IPrintingConfig <TOwner>)propertyConfig.ParentConfig).SetStringPropertyLength(propertyConfig.PropName, maxLen);
            }

            return(((IPropertyPrintingConfig <TOwner, string>)propConfig).ParentConfig);
        }
コード例 #3
0
 public static PrintingConfig <TOwner> Using <TOwner>(this PropertyPrintingConfig <TOwner, float> propConfig, CultureInfo cultureInfo)
 {
     return(((IPropertyPrintingConfig <TOwner, float>)propConfig).ParentConfig);
 }
コード例 #4
0
 public static PrintingConfig <TOwner> TrimmedToLength <TOwner>(this PropertyPrintingConfig <TOwner, string> propConfig, int maxLen)
 {
     return(((IPropertyPrintingConfig <TOwner, string>)propConfig).ParentConfig);
 }
コード例 #5
0
 public static PrintingConfig <TOwner> TrimmedToLength <TOwner>(
     this PropertyPrintingConfig <TOwner, string> propConfig, int maxLen)
 {
     propConfig.Using(s => s[0..Math.Min(s.Length, maxLen)]);
コード例 #6
0
 public static PrintingConfig <TOwner> TrimmedToLength <TOwner>
     (this PropertyPrintingConfig <TOwner, string> propConfig, int maxLen)
 {
     return(propConfig.Using(str => maxLen > str.Length ? str : str.Substring(0, maxLen)));
 }