Possible Duplicate:
? (nullable) operator in C#
What does the ? do used like this:
class Test
{
public int? aux;
}
It’s probably a simple question for someone more familiar with c#, but I don’t really know what to search for. I read an explanation but didn’t fully understand it. I would also be interested in knowing what the “??” operator does. Some examples on where they would be useful would be of great help.
It can be any int value plus an additional null. See more info Nullable Types
The purpose of using Nullable int is while often using database operations, there are conditions where some value might be null and we have to express in code. For Example consider the folowing schema
Suppose locationId of an employee is not available, so in database the value of locationid of employee is NULL. On C# side, you know that
intcan not have a NULL value, so type, Nullable int(and few others) has been added, due to which we can easily show that locationId has no value.