Ran across this line of code:
FormsAuth = formsAuth ?? new FormsAuthenticationWrapper();
What do the two question marks mean, is it some ki
Others have described the Null Coalescing Operator
quite well. In cases where a single test for null is required, the shortened syntax ??=
can add readability.
Legacy null test:
if (myvariable == null)
{
myvariable = new MyConstructor();
}
Using the Null Coalescing Operator this can be written:
myvariable = myvariable ?? new MyConstructor();
which can also be written with the shortened syntax:
myvariable ??= new MyConstructor();
Some find it more readable and succinct.