This topic has not yet been rated - Rate this topic

ICustomQueryInterface Interface

Enables developers to provide a custom, managed implementation of the IUnknown::QueryInterface(REFIID riid, void **ppvObject) method.

Namespace:  System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)
[ComVisibleAttribute(false)]
public interface class ICustomQueryInterface

The ICustomQueryInterface type exposes the following members.

  NameDescription
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetInterfaceReturns an interface according to a specified interface ID.
Top

This class permits advanced users to provide a customized managed implementation of the QueryInterface method.

Managed and native applications can use the customized implementation to return a specific interface for a specified interface ID, except for IID_IUnknown. That is, when QueryInterface is called, it will ignore custom implementations if its riid parameter is set to IID_IUnknown. However, you may still return IUnknown as the ppvObject.

Developers can provide custom implementations for all interfaces (except for IUnknown) if they define and implement a valid corresponding interface.

A valid user-defined interface has a v-table layout that matches the unmanaged COM interface exactly, and its InterfaceTypeAttribute is InterfaceIsIUnknown.

.NET Framework

Supported in: 4.5.1, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8, Silverlight 8.1
Obsolete (compiler warning) in Windows Phone 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.