What does the property pattern s is { Length: > 3 } test in C#?
Correct answer B. That s is not null and its Length property is greater than 3
Explanation
A property pattern checks that the input is non-null and that its named members match nested patterns. Here it requires s to be non-null and s.Length to satisfy the relational pattern > 3, so "hello" matches and "hi" or null do not. Property patterns can be nested to inspect deep object graphs in switch expressions without casts.
Answer checked How we write and check questions
Discussion