Editatu

TypeDelegator Class

Definition

Wraps a Type object and delegates methods to that Type.

public ref class TypeDelegator : System::Reflection::TypeInfo
public class TypeDelegator : System.Reflection.TypeInfo
type TypeDelegator = class
    inherit TypeInfo
Public Class TypeDelegator
Inherits TypeInfo
Inheritance
TypeDelegator

Remarks

Derive from this type and override only those members you have to provide customization in, plus any members that are required by your program and not already implemented by TypeDelegator.

TypeDelegator derives from System.Type and implements most of the properties and methods of Type. For each member it implements, TypeDelegator automatically delegates to the corresponding member of an internal Type object, which is supplied as an argument to the constructor. This internal Type object is exposed to deriving classes by the protected typeImpl field.

Note

Some members of TypeDelegator have implementations even though the members themselves are simply inherited from Type. In these cases, the implementation is provided by an overridden protected method that has a name that ends in "Impl". For example, the implementation for all overloads of the GetMethods method is supplied by the overridden GetMethodImpl method. The implementation for inherited properties such as IsPublic and IsNestedAssembly is provided by the overridden GetAttributeFlagsImpl method.

Deriving classes can provide a public constructor that takes a Type object as its parameter and simply passes that object to the TypeDelegator(Type) constructor, or can set the internal Type object in some other way.

If a deriving class uses a member that is not implemented by TypeDelegator, it must override that member and provide an implementation. The simplest implementation is to call the corresponding member on the internal Type object exposed by the typeImpl field, but you can provide any implementation your application requires. It is not necessary to override these members if they are not used by your application or by library functions your application calls (for example, by the CodeTypeReference.CodeTypeReference(Type) constructor).

The following virtual methods (Overridable methods in Visual Basic) of Type are not implemented by TypeDelegator: MakeGenericType, GetGenericTypeDefinition, GetGenericArguments, GetGenericParameterConstraints, MakeArrayType, MakeByRefType, MakePointerType, GetEnumNames, GetEnumValues, GetEnumUnderlyingType, GetTypeCodeImpl, IsEnumDefined, IsEquivalentTo.

The following virtual properties (Overridable properties in Visual Basic) of Type are not implemented by TypeDelegator: IsGenericType, IsGenericTypeDefinition, IsGenericParameter, ContainsGenericParameters, DeclaringMethod, GenericParameterAttributes, GenericParameterPosition, IsSecurityCritical, IsSecuritySafeCritical, IsSecurityTransparent.

Constructors

Name Description
TypeDelegator()

Initializes a new instance of the TypeDelegator class with default properties.

TypeDelegator(Type)

Initializes a new instance of the TypeDelegator class specifying the encapsulating instance.

Fields

Name Description
typeImpl

A value indicating type information.

Properties

Name Description
Assembly

Gets the assembly of the implemented type.

AssemblyQualifiedName

Gets the assembly's fully qualified name.

BaseType

Gets the base type for the current type.

CustomAttributes

Gets a collection that contains this member's custom attributes.

(Inherited from MemberInfo)
DeclaredConstructors

Gets a collection of the constructors declared by the current type.

(Inherited from TypeInfo)
DeclaredEvents

Gets a collection of the events defined by the current type.

(Inherited from TypeInfo)
DeclaredFields

Gets a collection of the fields defined by the current type.

(Inherited from TypeInfo)
DeclaredMembers

Gets a collection of the members defined by the current type.

(Inherited from TypeInfo)
DeclaredMethods

Gets a collection of the methods defined by the current type.

(Inherited from TypeInfo)
DeclaredNestedTypes

Gets a collection of the nested types defined by the current type.

(Inherited from TypeInfo)
DeclaredProperties

Gets a collection of the properties defined by the current type.

(Inherited from TypeInfo)
DeclaringType

Gets the type that declares the current nested type or generic type parameter.

(Inherited from Type)
FullName

Gets the fully qualified name of the implemented type.

GenericTypeParameters

Gets an array of the generic type parameters of the current instance.

(Inherited from TypeInfo)
GUID

Gets the GUID (globally unique identifier) of the implemented type.

ImplementedInterfaces

Gets a collection of the interfaces implemented by the current type.

(Inherited from TypeInfo)
IsByRefLike
IsCollectible

Gets the IsCollectible value for this object's typeImpl, which indicates whether this object, which is a MemberInfo implementation, references one or more assemblies held in a collectible AssemblyLoadContext.

IsConstructedGenericType

Gets a value that indicates whether this object represents a constructed generic type.

IsContextful

Gets a value indicating whether the Type can be hosted in a context.

(Inherited from Type)
IsFunctionPointer

Gets a value that indicates whether the current Type is a function pointer.

IsGenericMethodParameter
IsGenericTypeParameter
IsSecurityCritical

Gets a value that indicates whether the current type is security-critical or security-safe-critical at the current trust level, and therefore can perform critical operations.

(Inherited from Type)
IsSecuritySafeCritical

Gets a value that indicates whether the current type is security-safe-critical at the current trust level; that is, whether it can perform critical operations and can be accessed by transparent code.

(Inherited from Type)
IsSecurityTransparent

Gets a value that indicates whether the current type is transparent at the current trust level, and therefore cannot perform critical operations.

(Inherited from Type)
IsSignatureType

Gets a value that indicates whether the type is a signature type.

(Inherited from Type)
IsSZArray
IsTypeDefinition
IsUnmanagedFunctionPointer

Gets a value that indicates whether the current Type is an unmanaged function pointer.

IsVariableBoundArray
MetadataToken

Gets a value that identifies this entity in metadata.

Module

Gets the module that contains the implemented type.

Name

Gets the name of the implemented type, with the path removed.

Namespace

Gets the namespace of the implemented type.

ReflectedType

Gets the class object that was used to obtain this member.

(Inherited from Type)
TypeHandle

Gets a handle to the internal metadata representation of an implemented type.

UnderlyingSystemType

Gets the underlying Type that represents the implemented type.

Methods

Name Description
AsType()

Returns the current type as a Type object.

(Inherited from TypeInfo)
Equals(Object)

Determines if the underlying system type of the current Type object is the same as the underlying system type of the specified Object.

(Inherited from Type)
Equals(Type)

Determines if the underlying system type of the current Type is the same as the underlying system type of the specified Type.

(Inherited from Type)
GetAttributeFlagsImpl()

Gets the attributes assigned to the TypeDelegator.

GetConstructor(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

Searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

(Inherited from Type)
GetConstructor(BindingFlags, Binder, Type[], ParameterModifier[])

Searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints.

(Inherited from Type)
GetConstructor(BindingFlags, Type[])

Searches for a constructor whose parameters match the specified argument types, using the specified binding constraints.

(Inherited from Type)
GetConstructorImpl(BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

Gets the constructor that implemented the TypeDelegator.

GetConstructors(BindingFlags)

Returns an array of ConstructorInfo objects representing constructors defined for the type wrapped by the current TypeDelegator.

GetCustomAttributes(Boolean)

Returns all the custom attributes defined for this type, specifying whether to search the type's inheritance chain.

GetCustomAttributes(Type, Boolean)

Returns an array of custom attributes identified by type.

GetCustomAttributesData()

Returns a list of CustomAttributeData objects representing data about the attributes that have been applied to the target member.

(Inherited from MemberInfo)
GetDeclaredEvent(String)

Returns an object that represents the specified event declared by the current type.

(Inherited from TypeInfo)
GetDeclaredField(String)

Returns an object that represents the specified field declared by the current type.

(Inherited from TypeInfo)
GetDeclaredMethod(String)

Returns an object that represents the specified method declared by the current type.

(Inherited from TypeInfo)
GetDeclaredMethods(String)

Returns a collection that contains all methods declared on the current type that match the specified name.

(Inherited from TypeInfo)
GetDeclaredNestedType(String)

Returns an object that represents the specified nested type declared by the current type.

(Inherited from TypeInfo)
GetDeclaredProperty(String)

Returns an object that represents the specified property declared by the current type.

(Inherited from TypeInfo)
GetElementType()

Returns the Type of the object encompassed or referred to by the current array, pointer or ByRef.

GetEnumValuesAsUnderlyingType()

Retrieves an array of the values of the underlying type constants of this enumeration type.

(Inherited from Type)
GetEvent(String, BindingFlags)

Returns the specified event.

GetEvents()

Returns an array of EventInfo objects representing all the public events declared or inherited by the current TypeDelegator.

GetEvents(BindingFlags)

Returns the events specified in bindingAttr that are declared or inherited by the current TypeDelegator.

GetField(String, BindingFlags)

Returns a FieldInfo object representing the field with the specified name.

GetFields(BindingFlags)

Returns an array of FieldInfo objects representing the data fields defined for the type wrapped by the current TypeDelegator.

GetFunctionPointerCallingConventions()

When overridden in a derived class, returns the calling conventions of the current function pointer Type.

GetFunctionPointerParameterTypes()

When overridden in a derived class, returns the parameter types of the current function pointer Type.

GetFunctionPointerReturnType()

When overridden in a derived class, returns the return type of the current function pointer Type.

GetHashCode()

Returns the hash code for this instance.

(Inherited from Type)
GetInterface(String, Boolean)

Returns the specified interface implemented by the type wrapped by the current TypeDelegator.

GetInterfaceMap(Type)

Returns an interface mapping for the specified interface type.

GetInterfaces()

Returns all the interfaces implemented on the current class and its base classes.

GetMember(String, MemberTypes, BindingFlags)

Returns members (properties, methods, constructors, fields, events, and nested types) specified by the given name, type, and bindingAttr.

GetMembers(BindingFlags)

Returns members specified by bindingAttr.

GetMemberWithSameMetadataDefinitionAs(MemberInfo)

Searches for the MemberInfo on the current Type that matches the specified MemberInfo.

GetMemberWithSameMetadataDefinitionAs(MemberInfo)

Searches for the MemberInfo on the current Type that matches the specified MemberInfo.

(Inherited from Type)
GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

Searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

(Inherited from Type)
GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])

Searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints.

(Inherited from Type)
GetMethod(String, BindingFlags, Type[])

Searches for the specified method whose parameters match the specified argument types, using the specified binding constraints.

(Inherited from Type)
GetMethod(String, Int32, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

Searches for the specified method whose parameters match the specified generic parameter count, argument types and modifiers, using the specified binding constraints and the specified calling convention.

(Inherited from Type)
GetMethod(String, Int32, BindingFlags, Binder, Type[], ParameterModifier[])

Searches for the specified method whose parameters match the specified generic parameter count, argument types and modifiers, using the specified binding constraints.

(Inherited from Type)
GetMethod(String, Int32, BindingFlags, Type[])

Searches for the specified method whose parameters match the specified generic parameter count and argument types, using the specified binding constraints.

(Inherited from Type)
GetMethod(String, Int32, Type[], ParameterModifier[])

Searches for the specified public method whose parameters match the specified generic parameter count, argument types and modifiers.

(Inherited from Type)
GetMethod(String, Int32, Type[])

Searches for the specified public method whose parameters match the specified generic parameter count and argument types.

(Inherited from Type)
GetMethodImpl(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

Searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

GetMethodImpl(String, Int32, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[])

When overridden in a derived class, searches for the specified method whose parameters match the specified generic parameter count, argument types and modifiers, using the specified binding constraints and the specified calling convention.

(Inherited from Type)
GetMethods(BindingFlags)

Returns an array of MethodInfo objects representing specified methods of the type wrapped by the current TypeDelegator.

GetNestedType(String, BindingFlags)

Returns a nested type specified by name and in bindingAttr that are declared or inherited by the type represented by the current TypeDelegator.

GetNestedTypes(BindingFlags)

Returns the nested types specified in bindingAttr that are declared or inherited by the type wrapped by the current TypeDelegator.

GetOptionalCustomModifiers()

When overridden in a derived class, returns the optional custom modifiers of the current Type.

(Inherited from Type)
GetProperties(BindingFlags)

Returns an array of PropertyInfo objects representing properties of the type wrapped by the current TypeDelegator.

GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])

Searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.

(Inherited from Type)
GetPropertyImpl(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])

When overridden in a derived class, searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetRequiredCustomModifiers()

When overridden in a derived class, returns the required custom modifiers of the current Type.

(Inherited from Type)
GetType()

Gets the current Type.

(Inherited from Type)
GetTypeCodeImpl()

Returns the underlying type code of this Type instance.

(Inherited from Type)
HasElementTypeImpl()

Gets a value indicating whether the current Type encompasses or refers to another type; that is, whether the current Type is an array, a pointer or a ByRef.

HasSameMetadataDefinitionAs(MemberInfo) (Inherited from MemberInfo)
InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo)

Invokes the specified member, using the specified binding constraints and matching the specified argument list and culture.

(Inherited from Type)
InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])

Invokes the specified member. The method that is to be invoked must be accessible and provide the most specific match with the specified argument list, under the constraints of the specified binder and invocation attributes.

InvokeMember(String, BindingFlags, Binder, Object, Object[])

Invokes the specified member, using the specified binding constraints and matching the specified argument list.

(Inherited from Type)
IsArrayImpl()

Returns a value that indicates whether the Type is an array.

IsAssignableFrom(TypeInfo)

Returns a value that indicates whether the specified type can be assigned to this type.

IsAssignableTo(Type)

Determines whether the current type can be assigned to a variable of the specified targetType.

(Inherited from Type)
IsByRefImpl()

Returns a value that indicates whether the Type is passed by reference.

IsCOMObjectImpl()

Returns a value that indicates whether the Type is a COM object.

IsContextfulImpl()

Implements the IsContextful property and determines whether the Type can be hosted in a context.

(Inherited from Type)
IsDefined(Type, Boolean)

Indicates whether a custom attribute identified by attributeType is defined.

IsMarshalByRefImpl()

Implements the IsMarshalByRef property and determines whether the Type is marshaled by reference.

(Inherited from Type)
IsPointerImpl()

Returns a value that indicates whether the Type is a pointer.

IsPrimitiveImpl()

Returns a value that indicates whether the Type is one of the primitive types.

IsValueTypeImpl()

Returns a value that indicates whether the type is a value type; that is, not a class or an interface.

MakeFunctionPointerType(Type[], Boolean) (Inherited from Type)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a String representing the name of the current Type.

(Inherited from Type)

Explicit Interface Implementations

Name Description
IReflectableType.GetTypeInfo()

Returns a representation of the current type as a TypeInfo object.

(Inherited from TypeInfo)

Extension Methods

Name Description
GetConstructor(Type, Type[])
GetConstructors(Type, BindingFlags)
GetConstructors(Type)
GetCustomAttribute(MemberInfo, Type, Boolean)

Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttribute(MemberInfo, Type)

Retrieves a custom attribute of a specified type that is applied to a specified member.

GetCustomAttribute<T>(MemberInfo, Boolean)

Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttribute<T>(MemberInfo)

Retrieves a custom attribute of a specified type that is applied to a specified member.

GetCustomAttributes(MemberInfo, Boolean)

Retrieves a collection of custom attributes that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes(MemberInfo, Type, Boolean)

Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes(MemberInfo, Type)

Retrieves a collection of custom attributes of a specified type that are applied to a specified member.

GetCustomAttributes(MemberInfo)

Retrieves a collection of custom attributes that are applied to a specified member.

GetCustomAttributes<T>(MemberInfo, Boolean)

Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes<T>(MemberInfo)

Retrieves a collection of custom attributes of a specified type that are applied to a specified member.

GetDefaultMembers(Type)
GetEvent(Type, String, BindingFlags)
GetEvent(Type, String)
GetEvents(Type, BindingFlags)
GetEvents(Type)
GetField(Type, String, BindingFlags)
GetField(Type, String)
GetFields(Type, BindingFlags)
GetFields(Type)
GetGenericArguments(Type)
GetInterfaces(Type)
GetMember(Type, String, BindingFlags)
GetMember(Type, String)
GetMembers(Type, BindingFlags)
GetMembers(Type)
GetMetadataToken(MemberInfo)

Gets a metadata token for the given member, if available.

GetMethod(Type, String, BindingFlags)
GetMethod(Type, String, Type[])
GetMethods(Type, BindingFlags)
GetMethods(Type)
GetNestedTypes(Type, BindingFlags)
GetProperties(Type, BindingFlags)
GetProperties(Type)
GetProperty(Type, String, Type, Type[])
GetProperty(Type, String, Type)
GetProperty(Type, String)
GetRuntimeEvent(Type, String)

Retrieves an object that represents the specified event.

GetRuntimeEvents(Type)

Retrieves a collection that represents all the events defined on a specified type.

GetRuntimeField(Type, String)

Retrieves an object that represents a specified field.

GetRuntimeFields(Type)

Retrieves a collection that represents all the fields defined on a specified type.

GetRuntimeInterfaceMap(TypeInfo, Type)

Returns an interface mapping for the specified type and the specified interface.

GetRuntimeMethod(Type, String, Type[])

Retrieves an object that represents a specified method.

GetRuntimeMethods(Type)

Retrieves a collection that represents all methods defined on a specified type.

GetRuntimeProperties(Type)

Retrieves a collection that represents all the properties defined on a specified type.

GetRuntimeProperty(Type, String)

Retrieves an object that represents a specified property.

GetTypeInfo(Type)

Returns the TypeInfo representation of the specified type.

HasMetadataToken(MemberInfo)

Returns a value that indicates whether a metadata token is available for the specified member.

IsAssignableFrom(Type, Type)
IsDefined(MemberInfo, Type, Boolean)

Indicates whether custom attributes of a specified type are applied to a specified member, and, optionally, applied to its ancestors.

IsDefined(MemberInfo, Type)

Indicates whether custom attributes of a specified type are applied to a specified member.

IsInstanceOfType(Type, Object)

Applies to