How can I check null!
or null
in property initializer?
#51358
-
Hello! I'm stuck in checking property initializer. I want to check the properties with public Class? Property1 { get; }
public Class Property2 { get; } = null!;
public Class? Property3 { get; } = null; As the example shown, properties Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You mean that you want to find properties explicitly initialized with |
Beta Was this translation helpful? Give feedback.
-
The expression for |
Beta Was this translation helpful? Give feedback.
The expression for
Property2
will be wrapped in aSuppressNullableWarningExpression
, whereasProperty3
will not.SharpLab has a nice visualization of the syntax tree: