Chainable List.Add / typesafe

public static TList Push<TList, TItem>(this TList list, TItem item) where TList : IList<TItem>
{
    list.Add(item);
    return list;
}
Example:
var listTest = new List<string>().Push("test").Push("test2");
// listTest is now a list with two entries "test" and "test2"

Description

Allows you to chain .Add method

Details

Double click on the code to select all.

 

;