dotnet / dotnet/csharplang

Champion: extensions in pattern-based statements (16.3, Core 3)

Open
#2,135 12 comments 5 reactions 1 assignee Claimed by @jcouv View on GitHub
Implemented Needs ECMA Spec Proposal champion
Dominant language
C#
Stars
12.7k
Forks
1.1k
Avg merge
11h 1m
Merged PRs (30d)
3

Description

- [ ] Proposal added
- [ ] Discussed in LDM
- [ ] Decision in LDM
- [ ] Finalized (done, rejected, inactive)
- [ ] Spec'ed

Scenarios:
- ~~`using` statements and declarations, and `foreach` should find `Dispose()` extension methods (on ref structs)~~
- ~~`await using` statements and declarations, and `await foreach` should find `DisposeAsync()` extension methods (on any type)~~
- `foreach` statements should find `GetEnumerator()` extension methods on ref structs
- `await foreach` statements should find `GetAsyncEnumerator()` extension methods (on any type)

We should review other pattern-based statements

Being pattern-based means:
1. Binding “normally”, but only instance members
2. Going through the interface
3. Trying to bind extension methods

FYI @gafter

Relates to
- https://github.com/dotnet/csharplang/issues/1623 (enhanced-using)
- https://github.com/dotnet/csharplang/issues/43 (async-streams)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.