Compartir a través de


Building .NET Framework Components for Interoperation

Consider who will use your .NET Framework component before you build it. Your early efforts to identify whether callers are COM-based can save you substantial time in the future.

Although the .NET Framework extends many of the programming features introduced by COM, and the common language runtime provides simplified access across the interoperation boundary, a COM client must adhere to the restrictions of its programming model. These restrictions can impact how and when you use the extensive features available to .NET Framework components.

Use the considerations in following table as guidelines for writing a .NET Framework component based on the type of caller.

Expected caller Considerations
.NET clients only. No special considerations.
.NET and COM clients. See the considerations listed for COM clients only.
COM clients only.
  • Avoid using parameterized constructors.
  • Avoid using static methods.
  • Define event-source interfaces in managed code.
  • Include HRESULTs in user-defined exceptions.
  • Supply Globally Unique Identifiers (GUIDs) for types that require them.
  • Expect inheritance differences.

See Also

Design Considerations for Interoperation