From the project Roslyn
, file src\Compilers\CSharp\Portable\Syntax\CSharpSyntaxTree.cs
at line 446
there is:
using (var parser = new InternalSyntax.LanguageParser(lexer, oldTree?.GetRoot(), changes))
What is the ?.
there?
Does it check whatever oldTree is null
and if it's not then it's running the GetRoot
method, and if not then what it returns? This is my first assumption (Which might be wrong), but I can't get forward with it. (Confirm it, and/or answer the new question)
I googled What is ?. C#
and nothing related came up, it is as if it ignored my ?.
(?)
%= Modulus AND assignment operator. It takes modulus using two operands and assigns the result to the left operand. C %= A is equivalent to C = C % A.
The logical OR operator ( || ) returns the boolean value true if either or both operands is true and returns false otherwise.
It could be Null-Conditional Operator from C# 6.0:
The null-conditional operator conditionally checks for null before invoking the target method and any additional method within the call chain.
In your case, if oldTree
is null
,
oldTree?.GetRoot()
will return null
instead of trying to call GetRoot()
and throwing NullReferenceException
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With