c# initiate list with objects code example
Example 1: c# initialize list of objects
List<Cat> moreCats = new List<Cat>
{
new Cat{ Name = "Furrytail", Age=5 },
new Cat{ Name = "Peaches", Age=4 },
null
};
Example 2: c# new list object
var intList = new List<int>();