.NET 与 COM 互操作原理

本文详细介绍了.NET框架如何自然地从COM框架发展而来,包括组件重用、语言中立性、向前和向后兼容性等核心概念。通过使用COM互操作工具,可以将现有COM组件无缝整合到.NET应用程序中,并实现跨语言调用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

.NET Framework Developer's Guide
Advanced COM Interop

The .NET framework is a natural progression from COM because the two models share many central themes, including component reuse and language neutrality. For backward compatibility, COM interop provides access to existing COM components without requiring that the original component be modified. You can incorporate COM components into a .NET Framework application by using COM interop tools to import the relevant COM types. Once imported, the COM types are ready to use.

COM interop also introduces forward compatibility by enabling your COM clients to access managed code as easily as they access other COM objects. Again, COM interop provides the means to seamlessly export metadata in an assembly to a type library and registers the managed component as a traditional COM component. Both the import and export utilities produce results consistent with COM specifications. At run time, the common language runtime marshals data between COM objects and managed objects as needed.

In This Section
COM Wrappers
Describes the wrappers provided by COM interop.
Primary Interop Assemblies
Describes how to create and use primary interop assemblies.
Side-By-Side Execution for COM Interop
Describes how to safely share components through COM interop services.
Registration-Free COM Interop
Describes how COM interop can activate components without using the Windows registry.
HRESULTs and Exceptions
Describes the mapping between exceptions and HRESULTs.
Inheritance, Aggregation, and Containment
Describes various strategies for extending COM types.
Managed and Unmanaged Threading
Describes the threading differences that impact interoperation.
Managed and Unmanaged Events
Describes how to raise and handle events using COM interop.
Type Library to Assembly Conversion Summary
Describes the type library to assembly import conversion process.
Assembly to Type Library Conversion Summary
Describes the assembly to type library export conversion process.
Custom Marshaling
Describes the process for writing a custom marshaler for interoperation.
Related Topics
Exposing COM Components to the .NET Framework
Describes the process for calling COM types through COM interop.
Exposing .NET Framework Components to COM
Describes the preparation and use of managed types from COM.
Design Considerations for Interoperation
Provides tips for writing integrated COM types.
Interop Marshaling
Describes marshaling behavior for COM interop and platform invoke.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值