What is the Difference between .NET components and COM Components

前端 未结 4 776
情书的邮戳
情书的邮戳 2021-01-30 07:43

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. What is th

相关标签:
4条回答
  • 2021-01-30 08:01

    COM components are unmanaged C++ code components designed to make software reusable at binary level. 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. I think those are essential differences.

    EDIT:

    C++ is the most "natural" language in COM, but COM components can be created in MANY languages. Thanks for the comments people.

    0 讨论(0)
  • 2021-01-30 08:05

    .NET components run in the CLR, whereas COM components are essentially native Windows DLL's.

    .NET components also expose vastly more metadata than COM components. 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.

    See Don Box.

    0 讨论(0)
  • 2021-01-30 08:17

    .NET components are managed code (memory disposal is done for you)

    COM is an interface standard for software components. COM components are unmanaged code (memory disposal is performed using reference counting).

    From here:

    How are COM and .NET related?

    COM and .NET are complementary development technologies. The .NET Common Language Runtime provides bi-directional, transparent integration with COM. This means that COM and .NET applications and components can use functionality from each system. This protects your existing investments in COM applications while allowing you to take advantage of .NET at a controlled pace. COM and .NET can achieve similar results. 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. For new development, Microsoft recommends .NET as a preferred technology because of its powerful managed runtime environment and services.

    0 讨论(0)
  • 2021-01-30 08:19

    Some more information about this topic

    CCW : http://msdn.microsoft.com/en-us/library/f07c8z1c.aspx

    RCW : http://en.wikipedia.org/wiki/Runtime_Callable_Wrapper

    0 讨论(0)
提交回复
热议问题