Improve description of `limitations of extensions`
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 84/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- csharp
调研方向
阅读 docs/csharp/advanced-topics/interface-implementation/mixins-with-default-interface-methods.md,并结合 issue 中建议的措辞,审阅有关扩展成员解析的段落。更新说明,清楚描述变量的声明类型如何影响所调用的方法;当说明回应了提出的困惑,并与文章的术语一致时,即完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- 没有语言数据
- 星标
- 4.8k
- 派生
- 6.1k
- 平均合并
- 1 天 7 小时
- 30 天内合并 PR
- 222
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dotnet/docs 的其他 Issue
-
dg未关闭dotnet-fundamentals/svc needs-more-info
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
Document unit-test / theory-data impact of .NET 11 double→decimal conversion可能已有人在做 @SkyDevLab 于 9 天前认领。 未关闭:watch: Not Triaged dotnet-fundamentals/svc
难度 1/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
dotnet-fundamentals/svc install/subsvc
难度 2/5 1-3 小时 新手友好度 72/100
dotnet/docs#56344 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Upgrade from `net9.0` to LTS (or STS) image tag可能已有人在做 @ShyneChikwapulo 于 17 天前认领。 未关闭dotnet-target-version
难度 1/5 1 小时以内 新手友好度 85/100
dotnet/docs#56293 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Documentation for dotnet sln add doesn't mention the --include-references flag可能已有人在做 @BartoszKlonowski 于 17 天前认领。 未关闭dotnet-fundamentals/svc
难度 1/5 1 小时以内 新手友好度 92/100
dotnet/docs#56289 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
agent-butler-finding bug
难度 2/5 1-3 小时 新手友好度 82/100
jordansmall/spindrift#6236 ·
维护者通常 1 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 85/100
githubnext/gh-aw-workshop#5193 ·
维护者通常 1 天内回复
-
[oblt-aw][autodoc] Document new required `shared-org-key` input for `obs-aw-dependency-review`可能已有人在做 @github-actions 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
calcit-lang/caps#16 ·
-
agent bug
难度 1/5 1 小时以内 新手友好度 88/100