Accessing .NET Components from COM
It is also possible to access .NET components as COM components, although this scenario is not that common. To support this case, the .NET Framework creates a COM-callable wrapper (CCW) around the .NET object, as shown in Figure 7.2.
Figure 7.2. Accessing .NET components from COM.
Let's expose our console greeting .NET application from Chapter 2 as a COM component. Here is the code for the .NET application:
// Project NetFromCom/ConsoleGreeting namespace MyGreeting { public interface IGreeting { String UserName { set; } void Greet(); } public class ConsoleGreeting : IGreeting { private String m_userName; public ...
Get .NET Programming: A Practical Guide Using C# now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.