| Start |
|---|
| Null-Conditional Operator The Class used in the following example: If an object is potentially null (such as a function that returns a reference type) the object must first be checked for null to prevent a possible The same example using the null-conditional operator: Chaining the OperatorThe null-conditional operator can be combined on the members and sub-members of an object. Combining with the Null-Coalescing OperatorThe null-conditional operator can be combined with the null-coalescing operator (opens new window) to provide a default value: |
| The Null-Conditional Index Similarly to the is syntactic sugar for |
Avoiding NullReferenceExceptions This effect can be chained together: |
| Null-conditional Operator can be used with Extension Method Extension Method can work on null references (opens new window), but you can use Normally, the method will be triggered for Using This behavior is actually expected from the way in which the For more information on why the extension method is called in the first example, please see the Extension methods - null checking (opens new window) documentation. Syntax
RemarksNote that when using the null coalescing operator on a value type |
Read Article
https://develop.horje.com/learn/1434/reference