I have a type:
public class Human
{
public int Id { get; set; }
public string Address { get; set; }
public string Name { get; set; }
public List
You can initialize it just like any list:
public List ContactNumbers { get; set; }
public Human(int id)
{
Id = id;
ContactNumbers = new List();
}
public Human(int id, string address, string name) :this(id)
{
Address = address;
Name = name;
// no need to initialize the list here since you're
// already calling the single parameter constructor
}
However, I would even go a step further and make the setter private since you often don't need to set the list, but just access/modify its contents:
public List ContactNumbers { get; private set; }