Is there a reason to choose one of these over the other?
DateTime myDate = new DateTime();
or
DateTime myDate = default(DateTime);
Both of them are equal 1/1/0001 12:00:00 AM.
1/1/0001 12:00:00 AM
No, they are identical.
default(), for any value type (DateTime is a value type) will always call the parameterless constructor.
default()
DateTime
1.4m articles
1.4m replys
5 comments
57.0k users