I have had a code snippet comes to modify. In there i found this such syntax.
Session(\"LightBoxID\")?.ToString()
I didn\'t understand what
It's the Null-Conditional Operator It's a syntactic sugar for null checking:
return str?.ToString();
will become
if (str == null)
{
return null;
}
return str.ToString();
It performs a null-check on Session("LightBoxID")
before attempting to call .ToString()
on it.
MSDN: Null-conditional Operators (C# and Visual Basic)