Yes, that’s absolutely true.
In a line, MyListProperty = new List<MyObject>();you do not create objects through the property setting tool. First you create a new list, and then you set MyListPropertyto the list that you created. This is equivalent to:
List<MyObject> myObjectList = new List<MyObject>();
MyListProperty = myObjectList;
Next, if you want your code to compile, you must specify the type of your property:
public List<MyObject> MyListProperty
{
get {return myList;}
set {myList = value;}
}
source
share