c# initialize object in list 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: initialize list in c#
List<string> optionList = new List<string>
{ "AdditionalCardPersonAdressType", /* rest of elements */ };