private object Parse(object o, Type type, CsvColumnInfo info) { if (o is DBNull && AllowEmptyCells) { return o; } if (type == typeof (DateTime)) { var format = info.FormatProvider as DateTimeFormatInfo; return DateTime.ParseExact((string)o, format.FullDateTimePattern, format); } return info != null ? Convert.ChangeType(o, type, info.FormatProvider) : Convert.ChangeType(o, type); // e.g. for string }
private object Parse(object o, Type type, CsvColumnInfo info) { if (o is DBNull && AllowEmptyCells) { return(o); } if (type == typeof(DateTime)) { var format = info.FormatProvider as DateTimeFormatInfo; return(DateTime.ParseExact((string)o, format.FullDateTimePattern, format)); } return(info != null ? Convert.ChangeType(o, type, info.FormatProvider) : Convert.ChangeType(o, type)); // e.g. for string }