Chainable List.Add / typesafe
Allows you to chain .Add method
Source
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"
Author: ZBAGI
Submitted on: 12 feb. 2019
Language: C#
Type: System.Collections.Generic.IList<T>
Views: 4205