Improve description of `limitations of extensions`
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp
- Domain
- documentation
Research direction
Read docs/csharp/advanced-topics/interface-implementation/mixins-with-default-interface-methods.md and review the paragraph about extension member resolution alongside the proposed wording in the issue. Update the explanation so it clearly describes how the variable's declared type affects which method is called; done when the explanation addresses the confusion raised and matches the article's terminology.
Written by the indexing model from the issue text.
Description
Type of issue
Missing information
Description
I tried to understand the following sentences but it was not easy for me. For instance I missed the part that the method was not specified on interface so the method call resolved to e anxtension method.
Extension members are resolved at compile time, using the declared type of the variable. Classes that implement the interface can provide a better implementation for any extension member. Variable declarations must match the implementing type to enable the compiler to choose that implementation. When the compile-time type matches the interface, method calls resolve to the extension member.
I suggest we replace with
The compiler chooses an extension method based on the variable's declared type, not the object's actual type. If a class has its own method with the same name as an extension method, that method is used only when the variable is declared as that class. If the variable is declared as the interface, the compiler can't see the class's method, so it calls the extension method.
What do you think of it? Appreciate any feedbacks!
Page URL
Content source URL
Document Version Independent Id
98229926-6c7a-3ad1-ab5c-86231253986c
Platform Id
5f097f47-9790-5a92-55f5-70776d1c799f
Article author
@BillWagner
Metadata
- ID: 2c7899e8-3f01-41d2-137a-e334b73699a4
- PlatformId: 5f097f47-9790-5a92-55f5-70776d1c799f
- Service: dotnet-csharp
- Sub-service: advanced-concepts
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 215
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/docs
-
dgOpendotnet-fundamentals/svc needs-more-info
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
dotnet/docs#56549 · 1 comment ·
Maintainers usually reply within 1 day
-
Document unit-test / theory-data impact of .NET 11 double→decimal conversionPossibly taken @SkyDevLab claimed this 6 days ago. Open:watch: Not Triaged dotnet-fundamentals/svc
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
dotnet-fundamentals/svc install/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
dotnet/docs#56344 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Upgrade from `net9.0` to LTS (or STS) image tagPossibly taken @ShyneChikwapulo claimed this 14 days ago. Opendotnet-target-version
Difficulty 1/5 Under an hour Newbie friendliness 85/100
dotnet/docs#56293 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Documentation for dotnet sln add doesn't mention the --include-references flagPossibly taken @BartoszKlonowski claimed this 14 days ago. Opendotnet-fundamentals/svc
Difficulty 1/5 Under an hour Newbie friendliness 92/100
dotnet/docs#56289 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
criticalmanufacturing/cli#882 ·
Maintainers usually reply within 1 day
-
documentation skill: good first issue status: ready for dev testing
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
hyperledger-labs/fabric-smart-client#2327 ·
Maintainers usually reply within 1 day
-
agent-butler-finding chore
Difficulty 1/5 Under an hour Newbie friendliness 85/100
jordansmall/spindrift#6106 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
githubnext/gh-aw-workshop#5077 ·
Maintainers usually reply within 1 day