using System.Collections.Generic;
public record MyObj_3Properties(string Prop1, string Prop2, string Prop3);
public record MyObj_4Properties(string Prop1, string Prop2, string Prop3, string Prop4);
public static void Main()
var list_3Properties = new List<MyObj_3Properties> {
new MyObj_3Properties("A1", "B1", "C1"),
new MyObj_3Properties("A1", "B2", "C2"),
new MyObj_3Properties("A3", "B3", "C3")
Console.WriteLine("Object w/3 Properties");
Console.WriteLine(list_3Properties.Join(colSeparator: ',', rowSeparator: '\n'));
var list_4Properties = new List<MyObj_4Properties> {
new MyObj_4Properties("A1", "B1", "C1", "D1"),
new MyObj_4Properties("A1", "B2", "C2", "D2"),
new MyObj_4Properties("A3", "B3", "C3", "D3")
Console.WriteLine("\nObject w/4 Properties");
Console.WriteLine(list_4Properties.Join(colSeparator: ',', rowSeparator: '\n'));
public static class EnumerableStringJoinExtension
public static string Join<T>(this IEnumerable<T> values, char colSeparator, char? rowSeparator = null)
var strProperties = typeof(T).GetProperties().Where(r => r.PropertyType == typeof(string));
var sb = new StringBuilder();
foreach (var val in values)
sb.Append(string.Join(colSeparator, strProperties.Select(r => r.GetValue(val)))).Append(rowSeparator ?? colSeparator);
sb.Remove(sb.Length - 1, 1);