public static string SerializeToString <T>(T value) { if (value == null) { return(null); } if (typeof(T) == typeof(string)) { return(value as string); } var sb = new StringBuilder(); using (var writer = new StringWriter(sb, CultureInfo.InvariantCulture)) { CsvSerializer <T> .WriteObject(writer, value); } return(sb.ToString()); }
public static string ToCsv <T>(this T obj) { return(CsvSerializer.SerializeToString(obj)); }