It means "if id
or customerID
is null
, pretend it's "ALFKI"
instead.
sblom
2010-10-07 03:33:59
It means "if id
or customerID
is null
, pretend it's "ALFKI"
instead.
It's the null coalescing operator: http://msdn.microsoft.com/en-us/library/ms173224(VS.80).aspx
It provides a value (right side) when the first value (left side) is null.
That's the null-coalescing operator.
var x = y ?? z;
// is equivalent to:
var x = (y == null) ? z : y;
// also equivalent to:
if (y == null)
{
x = z;
}
else
{
x = y;
}
ie: x
will be assigned z
if y
is null
, otherwise it will be assigned y
.
So in your example, customerID
will be set to "ALFKI"
if it was originally null
.