Mono Class Library: System.Type Overview | Members

System.Type.GetInterface Method

Searches for the interface with the specified name.

public Type GetInterface (string name)

Parameters

name
A string containing the name of the interface to get.

Returns

A Type object representing the interface with the specified name, implemented or inherited by the current Type, if found; otherwise, null.

Exceptions

TypeReason
ArgumentNullExceptionname is null.
System.Reflection.AmbiguousMatchExceptionThe current instance represents a type that implements the same generic interface with different type arguments.

Remarks

The search for name is case-sensitive.

If the current instance represents a generic type, this method returns the Type with the type parameters replaced by the appropriate type arguments.

If the current instance represents an unassigned type parameter of a generic type or method, this method searches the interface constraints and any interfaces inherited from class or interface constraints.

Note: The name parameter cannot include type arguments.

Note: Even with the introduction of generics, this method continues to return only non-generic members. To get the generic ones, one must call Type.GetInterfaces, and filter them out.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0