O'Reilly logo

.NET Programming: A Practical Guide Using C# by Pradeep Tapadiya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required