Insert Element to IList - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:IList

Description

Insert Element to IList

Demo Code


using System.Collections;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from ww  w . j a  va2 s  .c o m

public class Main{
        public static IList<T> Insert<T>(this IList<T> source, T item, int index)
        {
            if (source == null)
                return null;

            source.Insert(index, item);

            return source;
        }
}

Related Tutorials