using System.Collections; using System.Text; namespace Jovian.Utilities { public static class ArrayUtility { public static string ListToString(this IList list, bool newLinePerEntry = false) { if(list == null) { return ""; } StringBuilder sb = new(); sb.Append("["); sb.Append(list.Count); sb.Append("]{"); if(newLinePerEntry) { sb.AppendLine(); } for(int i = 0, c = list.Count; i < c; i++) { sb.Append(list[i]); if(i < c - 1) { if(newLinePerEntry) { sb.AppendLine(","); } else { sb.Append(", "); } } } if(newLinePerEntry) { sb.AppendLine(); } sb.Append("}"); return sb.ToString(); } } }