dotnet/csharplang

[Proposal]: User-defined positional patterns

Opened this issue · 0 comments

User-defined positional patterns

Summary

Defining a named positional pattern which is not bound to a type check.

Exploring a different approach than the one originally presented in #1047 which suggests to relax Deconstruct to return bool.

This proposal does not conflict with bool-returning Deconstruct methods, i.e. both can exist at the same time, but this enables much more flexibility in this space as these patterns have a name of their own rather than just using the type's name.

Design meetings

https://github.com/dotnet/csharplang/blob/main/meetings/2022/LDM-2022-02-16.md#user-defined-positional-patterns