CSharp examples for System.Collections.Generic:IList
Create IList with one element
using System.Collections; using System;/*from ww w. j a v a 2 s .c om*/ public class Main{ public static IList singleton(object o) { ArrayList list = new ArrayList(); list.Add(o); return list; } public static bool add(ICollection list, object value) { if (!((IList) list).Contains(value)) { ((IList) list).Add(value); return true; } else return false; } }