You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update patterns.md with empty property pattern details (#49385)
* Update patterns.md with empty property pattern details
Clarify the behavior of the empty property pattern in C#.
* Add code example for empty property pattern
Added a code example demonstrating the use of an empty property pattern with variable creation in C#.
* Move sample to snippets.
Per conversation on #49385
* Update docs/csharp/language-reference/operators/patterns.md
Co-authored-by: Copilot <[email protected]>
---------
Co-authored-by: Bill Wagner <[email protected]>
Co-authored-by: Copilot <[email protected]>
This specifically means that the *empty* property pattern `is { }` matches everything non-null, and can be used instead of the `is not null` to create a variable: `somethingPossiblyNull is { } somethingDefinitelyNotNull`.
A property pattern is a recursive pattern. You can use any pattern as a nested pattern. Use a property pattern to match parts of data against nested patterns, as the following example shows:
0 commit comments