Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Model Namespace / IQuery­Interface Interface / IQuery­Interface Methods / IQuery­Interface.​Query­Interface(T) Method

IQueryInterface.QueryInterface<T> Method

Gets the implementation of a specified interface for the current object.

Namespace:  PostSharp.Patterns.Model
Assembly:  PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 5.0.39.0 (5.0.39.0)
Syntax
C#
T QueryInterface<T>()
where T : class

Type Parameters

T
The type of the required interface.

Return Value

Type: T
An object implementing the T interface on behalf of the current object, or null if the current object does not implement the T interface.
Remarks

This method shall return the current object if the type of the current object statically implements the interface. Otherwise, the method shall return another object that implements T on behalf of the current object. In this case, the returned object shall implement the IDynamicInterfaceImplementation interface, which allows to navigate back to the current object.

User code typically uses the QueryInterface<T>(Object, Boolean) extension method.

See Also