The output will be:
location is null
1/1/0001 12:00:00 AM
Although both variables are uninitialized, String is a reference type and DateTime is a value type. As a value type, an initialized DateTime variable is set to a default value of midnight of 1/1/1 (yup, that’s the year 1 A.D.), not null.
If you want to explore other questions about C#, you can check our videos section! Below we have some examples:
You can also subscribe to some channels that broadcast in C#, such as the following:
Another cool way to find out interesting things about C# is to access our project page!