public static string ToString(object o, string propertiesCsv) { System.Text.StringBuilder b = new StringBuilder(1024); foreach (string n in propertiesCsv.Split(',')) { if (PropertyExist(o, n)) { object v = GetProperty(o, n); if (v == null) { v = "null"; } if (v == DBNull.Value) { v = "DBNull"; } b.AppendFormat("{0}={1},", n, v); } } string s = b.ToString(); return(Utility.RemoveLastCharIf(s, ',')); }