CSharp examples for System.Collections.Generic:IList
Add First to IList
// The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; public class Main{ public static T[] AddFirst<T>(this IList<T> list, T item) {//w w w .ja va 2 s . com T[] res = new T[list.Count + 1]; res[0] = item; list.CopyTo(res, 1); return res; } }