No, this is not supported - you must specify a type parameter, but you can use collection initializers .
var list = new List<String> { "1", "2", "3" };
However, you could create a helper method
public static class ListUtilities { public static List<T> New<T>(params T[] items) { return new List<T>(items); } }
and use it like that.
var list = ListUtilities.New("1", "2", "3");
But it's probably not worth it; you get nothing, if anything. And first, it will create an array, and it will be used to populate the list. So this is not so different from Keith Nicholas var list = new[] { "1", "2", "3" }.ToList(); .
source share