CSharp examples for System.Collections.Generic:IList
IList To Comma String
using System.Text; using System.Collections.Generic; public class Main{ public static string ToCommaString<T>(IList<T> collection) {/* w ww .j a v a 2s . c o m*/ if (collection.Count == 0) return string.Empty; var buffer = new StringBuilder(); for (int i = 0; i < collection.Count; i++) { if (i == collection.Count - 1) buffer.Append(collection[i]); else buffer.AppendFormat("{0},", collection[i]); } return buffer.ToString(); } }