When creating a DateTime object, there are only 4 properties available in the Object Initialization list, however this class has atleast 10 public properties. I was curious why wouldn’t all the public properties be available in the Object Initilization as this has always been the case in the past. (Note once the object is created I could then use datetime. and see all the properties.)
DateTime datetime = new DateTime() {
Date = null,
DayOfWeek = null,
TimeOfDay = null,
Kind = null
}
It will show only those properties which are
Publicproperties and have aSetterYou code won’t compile because these properties don’t have a
Setterthey areRead Only