惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

SecWiki News
SecWiki News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
博客园 - 叶小钗
S
SegmentFault 最新的问题
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
腾讯CDC
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
L
Lohrmann on Cybersecurity
量子位
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
J
Java Code Geeks
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
博客园 - 三生石上(FineUI控件)
Attack and Defense Labs
Attack and Defense Labs
AI
AI
The Cloudflare Blog
T
Tailwind CSS Blog
S
Schneier on Security
爱范儿
爱范儿
PCI Perspectives
PCI Perspectives
Stack Overflow Blog
Stack Overflow Blog
S
Secure Thoughts
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
The Exploit Database - CXSecurity.com
博客园 - 【当耐特】
V2EX - 技术
V2EX - 技术
S
Securelist
P
Proofpoint News Feed
T
Threat Research - Cisco Blogs
Help Net Security
Help Net Security
C
Cisco Blogs
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
K
Kaspersky official blog
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
S
Security Affairs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Simon Willison's Weblog
Simon Willison's Weblog

博客园 - 梅子黄时雨

离职反思 人际交往能力:远比你想象的重要 关于晋升 生产力提升计划 向企业一样的思考 在CentOS上搭建WordPress的博客系统 Some Useful LINQ Extension Methods MVC模式 IIS7.5配置 An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode. C# 整数和byte数组互换 C#实现的堆栈 ASP.NET 验证控件 Gridview中合并单元格,某字段的内容相同时如何只显示一个,屏蔽相同列或行的内容(转) C#winform 配置webconfig 动态SQL EXEC DELL 1520 笔记本拆机 关于表变量 华为致新员工书
显式接口成员实现
梅子黄时雨 · 2012-02-28 · via 博客园 - 梅子黄时雨

类或结构可以通过使用显示接口实现来避免将成员声明为 public. 显示接口成员实现使用完全限定的接口成员名。例如 EidtBox类可以使用显示接口成员实现来实现IControl的Paint方法和IDataBind的Bind方法。

   1:      public class Binder
   2:      {
   3:          //
   4:      }
   5:      public interface IControl
   6:      {
   7:          void Paint();
   8:      }
   9:      public interface IDataBind
  10:      {
  11:          void Bind(Binder b);
  12:      }
  13:      public class EditBox : IControl,IDataBind
  14:      {
  15:          #region IControl Members
  16:   
  17:          public void IControl.Paint()
  18:          {
  19:              throw new NotImplementedException();
  20:          }
  21:   
  22:          #endregion
  23:   
  24:          #region IDataBind Members
  25:   
  26:          public void IDataBind.Bind(Binder b)
  27:          {
  28:              throw new NotImplementedException();
  29:          }
  30:   
  31:          #endregion
  32:      }
调用方法:
   1:          static void Main(string[] args)
   2:          {
   3:              IControl editBox = new EditBox();
   4:              editBox.Paint();//正确
   5:              EditBox edit = new EditBox();
   6:              edit.Paint();//错误,找不到方法
   7:          }