I have a class with a property: public MyClass myProperty { get; set; }. When a object is created, this property is null.
I wanted it to automatically call a MyClass() and instantiate this property, and compiler throw error for a myObject.myProperty = null;.
Is it possible to do that in C#? Or do I need to encapsulate a verification in the property's getter?