Exemple #1
0
        private static Func <string, object> GetParser <T>(CultureInfo culture, CsvColumnInfo <T> column, Func <CsvColumnInfo <T>, CultureInfo, Func <string, object> > parserFactory)
        {
            if (parserFactory != null)
            {
                var result = parserFactory(column, culture);

                if (result != null)
                {
                    return(result);
                }
            }

            return(str => ConvertTo(str, column.MemberInfo.ReturningType(), culture, column.Format));
        }
Exemple #2
0
        private static Func <object, string> GetToString <T>(CultureInfo culture, CsvColumnInfo <T> column, Func <CsvColumnInfo <T>, CultureInfo, Func <object, string> > toStringFactory)
        {
            if (toStringFactory != null)
            {
                var result = toStringFactory(column, culture);

                if (result != null)
                {
                    return(result);
                }
            }

            return(obj => ConvertToString(obj, column.Format, culture));
        }