Possible duplicates:?? Null Coalescing Operator β What does a merge mean? What do two question marks mean in C #?
I could not find this question being asked here, so I decided that I would ask about it. What does a double question mark do in C #?
Example:
x = y ?? z;
This is the operator of zero coalescence. For the method above states x, the value y is assigned if y is not equal to zero, in which case it is assigned the value z.
Use y if not null, otherwise use z
From Wikipedia :
This is the null coalescence operator and the abbreviation for this is:
x = (y != null ? y : z);
If y is null, z will be set.
If y is null, then z is assigned.
For example:
x = Person.Name ?? "No Name";
If the name is null, it will be "No name"
As others have claimed, this is a null coalescing operator.
MSDN information about this:
http://msdn.microsoft.com/en-us/library/ms173224.aspx
.Net framework 2.0 supports null values ββfor Nullable types.
here, in this case, it says x is equal to y if it has some value (i.e. is not null), or equal to z