Ran across this line of code:
FormsAuth = formsAuth ?? new FormsAuthenticationWrapper();
What do the two question marks mean, is it some ki
The two question marks (??) indicate that its a Coalescing operator.
Coalescing operator returns the first NON-NULL value from a chain. You can see this youtube video which demonstrates the whole thing practically.
But let me add more to what the video says.
If you see the English meaning of coalescing it says “consolidate together”. For example below is a simple coalescing code which chains four strings.
So if str1
is null
it will try str2
, if str2
is null
it will try str3
and so on until it finds a string with a non-null value.
string final = str1 ?? str2 ?? str3 ?? str4;
In simple words Coalescing operator returns the first NON-NULL value from a chain.