RealProxy.SupportsInterface Method (Guid)

 

Requests a COM interface with the specified ID.

Namespace:   System.Runtime.Remoting.Proxies
Assembly:  mscorlib (in mscorlib.dll)

public virtual IntPtr SupportsInterface(
	ref Guid iid
)

Parameters

iid
Type: System.Guid

A reference to the requested interface.

Return Value

Type: System.IntPtr

A pointer to the requested interface.

The SupportsInterface method allows the current proxy instance to implement additional COM interfaces on behalf of the server object that the current instance represents. The current method generates the requested interface and returns a pointer to it. The types of COM interfaces that can be generated by this method depend on the proxy type, which in turn might depend on the type of the server object that the current proxy instance represents.

For more information, see ProxyAttribute.

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
public override IntPtr SupportsInterface(ref Guid myGuid)
{
   Console.WriteLine("SupportsInterface method called");
   // Object reference is requested for communication with unmanaged objects
   // in the current process through COM.
   IntPtr myIntPtr = this.GetCOMIUnknown(false);
   // Stores an unmanaged proxy of the object.
   this.SetCOMIUnknown(myIntPtr);
   // return COM Runtime Wrapper pointer.
   return myIntPtr;
}

.NET Framework
Available since 1.1
Return to top
Show: