This project has moved. For the latest updates, please go here.

COMObject is the common base type for all objects in NetOffice and also represents a COM Proxy whose type is unknown at compile-time, but still is a COMProxy in every case (not a scalar type like bool or int). Take a look at the following code example:

foreach (Office.COMAddIn item in application.COMAddIns) 
{ 
    /* COMAddIn.Application is defined as COMObject 
     * The definintion in COM TypeLibrary is VT_DISPATCH. Interop Assemblies or VBA mapped this to simple object */ 
     Excel.Application parentApplication = (Excel.Application)item.Application; 
}

Also take at: Tutorial05

Class definition

/*    class COMObject
   the common base type for all objects in NetOffice. 
*/

// Constructors

   COMObject()

   COMObject(object comProxy)

   COMObject(COMObject replacedObject)

   COMObject(COMObject parentObject, object comProxy)

   COMObject(COMObject parentObject, object comProxy, Type comProxyType)

// Properties

   /// <summary>
   /// returns the native wrapped proxy
   /// </summary>
   object UnderlyingObject{ get; }

   /// <summary>
   /// returns class name of native wrapped proxy
   /// </summary>
   string UnderlyingTypeName{ get; }

   /// <summary>
   /// returns instance is diposed means unusable
   /// </summary> 
   bool IsDisposed{ get; }

// Methods

   /// <summary>
   /// dispose instance and all child instances
   /// </summary>
   void Dispose();

   /// <summary>
   /// dispose instance and all child instances
   /// </summary>
   /// <param name="disposeEventBinding">dispose event exported proxies with one or more event recipients</param>
   void Dispose(bool disposeEventBinding);

   /// <summary>
   /// dispose all child instances
   /// </summary>
   void DisposeChildInstances();

   /// <summary>
   /// dispose all child instances
   /// </summary>
   /// <param name="disposeEventBinding">dispose event exported proxies with one or more event recipients</param>
   void DisposeChildInstances(bool disposeEventBinding); 

Last edited May 18, 2011 at 10:49 PM by SebastianDotNet, version 5

Comments

No comments yet.