WorkItem.State[States.Permit] = myState.Permit ?? null;
Open in new window
// y = x, unless x is null, in which case y = -1.
int y = x ?? -1;
y = x ?? null;
The ?? operator is called the null-coalescing operator and is used to define a default value for nullable value types or reference types. It returns the left-hand operand if the operand is not null; otherwise it returns the right operand.
IT issues often require a personalized solution. With Ask the Experts™, submit your questions to our certified professionals and receive unlimited, customized solutions that work for you.
Take hold of your future.