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

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
T
Threat Research - Cisco Blogs
小众软件
小众软件
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Tailwind CSS Blog
Cisco Talos Blog
Cisco Talos Blog
V
V2EX
博客园 - 【当耐特】
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
The Cloudflare Blog
The Last Watchdog
The Last Watchdog
Simon Willison's Weblog
Simon Willison's Weblog
T
Threatpost
S
Secure Thoughts
O
OpenAI News
P
Proofpoint News Feed
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
Scott Helme
Scott Helme
T
Tenable Blog
A
Arctic Wolf
L
LINUX DO - 热门话题
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
博客园 - Franky
WordPress大学
WordPress大学
Know Your Adversary
Know Your Adversary
博客园_首页
雷峰网
雷峰网
IT之家
IT之家
PCI Perspectives
PCI Perspectives
L
LINUX DO - 最新话题
H
Heimdal Security Blog

博客园 - Zhongjian Zhang

.net framework profiles /.net framework 配置 人生的意义岂止是谋生-新视野大学英语第二册第八单元A课文 - Zhongjian Zhang - 博客园 格式化类型和分析字符串 LG 3D投影 directory searchPattern to regex pattern Textbox/ComboBox 自动完成AutoCompletion Bloom's Taxonomy/布鲁姆分类 Data Structure/数据结构 in .Net Custom Shapes/Combin Shapes/合并图形 in PowerPoint 2010 scale up vs scale out/Scale vertically vs. horizontally Window Types(Tool windows/document windows)/窗口类型(工具窗口/文档窗口) in VS VS2010中shortcut key快捷键一览下载 随机long(Random long/NextLong) Windows Azure Storage Explorer List System Error Codes/系统错误代码 图解500强 超级计算机 In graphics: Supercomputing superpowers FTP active mode and assive mode(ftp 主动模式/被动模式) Ftp commands and options 为VM制作可引导的操作系统ISO
类接口/Class Interface
Zhongjian Zhang · 2010-10-27 · via 博客园 - Zhongjian Zhang

在查看Object类的定义时发现Object使用了ClassInterface,而且是ClassInterfaceType.AutoDual故查看一下具体什么,原来是类接口是为互操作而设计的,其中写到托管代码中基类或接口的中顺序也会影响互操作,真是不应乱该动代码。:)

类接口是未在托管代码中显式定义的接口,它将公开在 .NET 对象上显式公开的所有公共方法、属性、字段和事件。此接口可以是双绑定接口,也可以是仅调度接口。类接口将接收 .NET 类本身的名称,并在名称前加有下划线。例如,对于 Mammal 类,类接口为 _Mammal。

其中写到:

限制将双绑定接口选项用于类接口。

双绑定接口支持 COM 客户端对接口成员进行早期和后期绑定。在设计时和测试期间,您可能会发现将类接口设置为双绑定非常有用。对于从不会修改的托管类(及其基类),此选项也是可以接受的。在其他所有情况下,应避免将类接口设置为双绑定。

自动生成的双绑定接口可能会适用于少数的情况,而在多数情况下,它会带来与版本相关的复杂性。例如,使用派生类的类接口的 COM 客户端很容易在遇到对基类的更改时中断。当第三方提供基类时,您将无法控制类接口的布局。此外,与仅调度接口不同,双绑定接口 (ClassInterface.AutoDual) 在导出的类型库中提供了类接口的说明。这样的说明会促使后期绑定的客户端在运行时缓存 DispId。

看来Object中public的方法非static的顺序应该是不会更改的了。

[Serializable, ClassInterface(ClassInterfaceType.AutoDual), ComVisible(true)]
public class Object
{
    // Methods
    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail), TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
    public Object();
    [TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
    public virtual bool Equals(object obj);
    [TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
    public static bool Equals(object objA, object objB);
    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
    protected virtual void Finalize();
    [TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
    public virtual int GetHashCode();
    [MethodImpl(MethodImplOptions.InternalCall), SecuritySafeCritical]
    public extern Type GetType();
    [MethodImpl(MethodImplOptions.InternalCall), SecuritySafeCritical]
    protected extern object MemberwiseClone();
    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success), TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
    public static bool ReferenceEquals(object objA, object objB);
    public virtual string ToString();
}