CSharp examples for System.Collections:ICollection
Implode ICollection to String
using System.Collections.Specialized; using System.Collections; using System.Text; using System.Linq; using System.Collections.Generic; using System;/* w ww.j av a 2 s . c om*/ public class Main{ public static string Implode(ICollection collection, string separator) { if (collection == null || collection.Count == 0) return string.Empty; if (separator == null) separator = string.Empty; StringBuilder sb = new StringBuilder(); foreach (object item in collection) { sb.Append(item.ToString() + separator); } string result = sb.ToString().TrimEnd(separator.ToCharArray()); return result; } }