Unusual if statement in MaterialDesign codebase - would appreciate help #3339
-
Hi, when browsing the codebase, I came across the following if statement: I have not kept up with changes in the C# language, would appreciate if you could explain how the braces and the variable work. And most importantly, what is the official name of this construct in C# standard? |
Beta Was this translation helpful? Give feedback.
Answered by
Keboo
Oct 16, 2023
Replies: 1 comment 1 reply
-
The name for this is "property pattern matching". It is both performing a null check, but if the value of You can read more about it here: https://essentialcsharp.com/pattern-matching#property-patterns-c-8-0-10-0 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
sabuncumurat
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The name for this is "property pattern matching". It is both performing a null check, but if the value of
HintProxy
is not null, it will assign the non-null value tohintProxy
and the expression returns true.You can read more about it here: https://essentialcsharp.com/pattern-matching#property-patterns-c-8-0-10-0