Kerollos Adel

public static List<T> InsertFirst<T>(this  List<T> lst, T Obj)
        {
            List<T> NewList = new List<T>();

            NewList.Add(Obj);
            NewList.AddRange(lst);

            return NewList;
        }
Example:
List<int> NumberList = new List<int>() {0 , 1, 2, 3, 4, 5, 6, 7 };
            NumberList = NumberList.InsertFirst(-1);

Description

insert item in the top of list

Details

Double click on the code to select all.

 

;