tags:

views:

24

answers:

3

In .NET 4.0 if you create a Calendar and you look at the SelectedDate field it is of type "DateTime?". What's the deal with the ? at the end of the type?

+4  A: 

? at the end means it's nullable, as in, the control may not have a SelectedDate at all.

See: http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx

JeffN825
+2  A: 

? at the end means that a value type can also be null.

elsni
+2  A: 

DateTime? means Nullable<DateTime> that's meaning that this property can hold null. Meanwhile just DateTime - cannot.

See more about Nullable Types on MSDN

abatishchev