CSharp examples for System.Collections.Generic:ICollection
Converts a collection of objects to a comma separated string representing the objects.
using System.Linq; using System.Collections.ObjectModel; using System.Collections.Generic; using System;//from ww w . j a v a2 s . c o m public class Main{ /// <summary> /// Converts a collection of objects to a comma separated string representing the objects. /// </summary> /// <param name="collection"> /// The collection to join. /// </param> /// <typeparam name="T"> /// The type of object within the collection. /// </typeparam> /// <returns> /// Returns a string representation of the items within the collection separated by a comma. /// </returns> public static string ToCommaSeparatedString<T>(this IEnumerable<T> collection) { return string.Join(",", collection); } }