Sdílet prostřednictvím


FlavoredProjectBase.GetComInterface<TInterface> Method

Definition

A project derived from this base class will be aggregated with a native COM component (the ProjectAggregator object) that can also aggregate an inner project in case of flavoring.

public:
generic <typename Interface_T>
 where Interface_T : class Interface_T GetComInterface();
public:
generic <typename TInterface>
 where TInterface : class TInterface GetComInterface();
public:
generic <typename Interface_T>
 where Interface_T : class Interface_T GetComInterface();
template <typename Interface_T>
 where Interface_T : class Interface_T GetComInterface();
public Interface_T GetComInterface<Interface_T> () where Interface_T : class;
public TInterface GetComInterface<TInterface> () where TInterface : class;
member this.GetComInterface : unit -> 'Interface_T (requires 'Interface_T : null)
member this.GetComInterface : unit -> 'Interface (requires 'Interface : null)
Public Function GetComInterface(Of Interface_T As Class) () As Interface_T
Public Function GetComInterface(Of TInterface As Class) () As TInterface

Type Parameters

Interface_T
TInterface

Returns

Interface_T
TInterface

Returns Int32.

Remarks

All the requests for interfaces exposed to COM must be handled by the external object that has a special implementation of QueryInterface that handles both inner and outer projects.

If you don’t use this helper method when requesting an interface you can get unexpected InvalidCast exceptions.

If you want to get the implementation of an interface implemented by your FlavoredProjectBase-derived object, then you must use the standard cast operator.

Applies to