As others have noted ? used for declaring a value type as nullable .
This is great in two situations:
- When retrieving data from a database with a null value stored in a field with a null value (which matches the type of the .NET value)
- When you need to represent "not specified" or "not found."
For example, consider a class used to represent feedback from a client who was asked a series of optional questions:
class CustomerFeedback { string Name { get; set; } int? Age { get; set; } bool? DrinksRegularly { get; set; } }
The use of DrinksRegularly types for Age and DrinksRegularly can be used to indicate that the client has not answered these questions.
In the example you are quoting, I would take the null value for LastLogon to mean that the user has never logged in.
Richard Everett
source share