简体   繁体   English

.NET组件和COM组件之间有什么区别

[英]What is the Difference between .NET components and COM Components

What is the Difference between .NET components and COM Components, sometimes we use .NET Components to include in our projects and sometimes we include COM reference. .NET组件和COM组件之间有什么区别,有时我们使用.NET组件包含在我们的项目中,有时我们包含COM引用。 What is the idea behind? 背后的想法是什么?

.NET components are managed code (memory disposal is done for you) .NET组件是托管代码(内存处理已完成)

COM is an interface standard for software components. COM是软件组件的接口标准。 COM components are unmanaged code (memory disposal is performed using reference counting). COM组件是非托管代码(使用引用计数执行内存处理)。

From here : 这里

How are COM and .NET related? COM和.NET如何相关?

COM and .NET are complementary development technologies. COM和.NET是互补的开发技术。 The .NET Common Language Runtime provides bi-directional, transparent integration with COM. .NET公共语言运行时提供与COM的双向,透明集成。 This means that COM and .NET applications and components can use functionality from each system. 这意味着COM和.NET应用程序和组件可以使用每个系统的功能。 This protects your existing investments in COM applications while allowing you to take advantage of .NET at a controlled pace. 这可以保护您在COM应用程序中的现有投资,同时允许您以受控的速度利用.NET。 COM and .NET can achieve similar results. COM和.NET可以实现类似的结果。 The .NET Framework provides developers with a significant number of benefits including a more robust, evidence-based security model, automatic memory management and native Web services support. .NET Framework为开发人员提供了大量优势,包括更强大,基于证据的安全模型,自动内存管理和本机Web服务支持。 For new development, Microsoft recommends .NET as a preferred technology because of its powerful managed runtime environment and services. 对于新开发,Microsoft建议使用.NET作为首选技术,因为它具有强大的托管运行时环境和服务。

COM components are unmanaged C++ code components designed to make software reusable at binary level. COM组件是非托管C ++代码组件,旨在使软件在二进制级别可重用。 NET components are similar altough 1) they can be created on CLR-languages while COM components can be built with C++ only 2) They are meant to run under a managed runtime. .NET组件类似,1)它们可以在CLR语言上创建,而COM组件只能用C ++构建2)它们是在托管运行时下运行的。 I think those are essential differences. 我认为这些是本质区别。

EDIT: 编辑:

C++ is the most "natural" language in COM, but COM components can be created in MANY languages. C ++是COM中最“自然”的语言,但COM组件可以用多种语言创建。 Thanks for the comments people. 感谢大家的评论。

.NET components run in the CLR, whereas COM components are essentially native Windows DLL's. .NET组件在CLR中运行,而COM组件本质上是本机Windows DLL。

.NET components also expose vastly more metadata than COM components. .NET组件还暴露出比COM组件更多的元数据。 This redesign was undertaken in part to make components more interoperable. 重新设计的部分原因是为了使组件更具互操作性。 In particular, .NET components do not make platform-specific assumptions about data layout and calling conventions. 特别是,.NET组件不会针对数据布局和调用约定做出特定于平台的假设。

See Don Box . 唐盒子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM