Click here to Skip to main content
15,896,269 members
Articles / Programming Languages / C++

Understanding Classic COM Interoperability With .NET Applications

Rate me:
Please Sign up or sign in to vote.
4.96/5 (207 votes)
24 Jul 2001 1.3M   11.9K   715  
Discusses how existing COM components can be used from managed code.
using System;
using IceCreamMenuMetadata;

public class IceCreamMenuClient
{
    public static void Main(String[] args)
    {
        // Create an instance of the Collection class
        IceCreamMenu menu = new IceCreamMenu();

        // Add a few more flavors to the Menu
        menu.AddFlavortoMenu("Chocolate Chip");
        menu.AddFlavortoMenu("Blueberry");
		
        // Use the foreach to iterate through the elements in the
        // collection since the IEnumXXXX in the COM world is 
        // mapped into an IEnumerator in the .NET World
        foreach(Object objFlavor in menu)
        {
           System.Console.WriteLine("{0}",objFlavor);
        }

   }/* end Main */

}/* end class IceCreamMenuClient */

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions