We just can use function like
public static List<T> New<T>(params T[] items) {
return new List<T>(items);
}
and more important it's better
var list = new List<int> {1,2,3};
var list = List.New(1,2,3);
So, when we really need to use it?
Dictionary
public static Dictionary<T, K> New<T, K>(T key, K value) {
return new Dictionary<T,K>().FAdd(key, value);
}
var dict = new Dictionary<int, string>(){
{1, "a"},
{2, "b"}
};
var dict = Dict.New(1,"a").FAdd(2, "b");
Why it's better, type inference
var x = new Dictionary<string, List<int>>(){
{"a", new List<int>{1}},
{"b", new List<int>{2}},
}
var x = Dict.New("a", List.New(1)).FAdd("b", List.New(2));