BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 This type is safe for multithreaded operations. System.Reflection.MemberInfo System.Reflection.MemberInfo Reflection System.Reflection.IReflect System.Runtime.InteropServices._Type System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None) System.Runtime.InteropServices.ComDefaultInterface(typeof(System.Runtime.InteropServices._Type)) System.Runtime.InteropServices.ComVisible(true)

Type is the root of the functionality and is the primary way to access metadata. Use the members of Type to get information about a type declaration, such as the constructors, methods, fields, properties, and events of a class, as well as the module and the assembly in which the class is deployed.

The C# typeof operator (GetType operator in Visual Basic, typeid operator in Visual C++) returns a Type object.

A Type object that represents a type is unique; that is, two Type object references refer to the same object if and only if they represent the same type. This allows for comparison of Type objects using reference equality.

No permissions are required for code to use reflection to get information about types and their members, regardless of their access levels. No permissions are required for code to use reflection to access public members, or other members whose access levels would make them visible during normal compilation. However, in order for your code to use reflection to access members that would normally be inaccessible, such as private or internal methods, or protected fields of a type your class does not inherit, your code must have . See Security Considerations for Reflection.

Type is an abstract base class that allows multiple implementations. The system will always provide the derived class RuntimeType. In reflection, all classes beginning with the word Runtime are created only once per object in the system and support comparison operations.

In multithreading scenarios, do not lock objects in order to synchronize access to static data. Other code, over which you have no control, might also lock your class type. This might result in a deadlock. Instead, synchronize access to static data by locking a private static object.

This class is thread safe; multiple threads can concurrently read from an instance of this type. An instance of Type can represent any of the following types:

Classes

Value types

Arrays

Interfaces

Pointers

Enumerations

Constructed generic types and generic type definitions

Type arguments and type parameters of constructed generic types, generic type definitions, and generic method definitions

A reference to the Type object associated with a type can be obtained in the following ways:

The method returns a Type object that represents the type of an instance.

The static GetType methods return a Type object that represents a type specified by its fully qualified name.

The , , and methods return Type objects that represent the types defined in a module. The first method can be used to obtain an array of Type objects for all the public and private types defined in a module. (You can obtain an instance of Module through the or method, or through the property.)

The object contains a number of methods to retrieve the classes defined in an assembly, including , , and .

The method returns a filtered list of interface types supported by a type.

The method returns a Type object that represents the element.

The and methods return Type objects representing the interface types supported by a type.

The method returns an array of Type objects representing the types specified by an arbitrary set of objects. The objects are specified with an array of type Object.

The and methods are provided for COM interoperability. They return a Type object that represents the type specified by a ProgID or CLSID.

The method is provided for interoperability. It returns a Type object that represents the type specified by a class handle.

The C# typeof operator, the C++ typeid operator, and the Visual Basic GetType operator obtain the Type object for a type.

The method returns a object representing a constructed generic type, which is an open constructed type if its property returns true, and a closed constructed type otherwise. A generic type can be instantiated only if it is closed.

The , , and methods return objects that represent, respectively, an array of a specified type, a pointer to a specified type, and the type of a reference parameter (ref in C#, ByRef in Visual Basic).

A derived class can access protected members of the calling code's base classes. Also, access is allowed to assembly members of the calling code's assembly. As a rule, if you are allowed access in early-bound code, then you are also allowed access in late-bound code.

Interfaces that extend other interfaces do not inherit the methods defined in the extended interfaces.

Represents type declarations: class types, interface types, array types, value types, enumeration types, type parameters, generic type definitions, and open or closed constructed generic types.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  This constructor is invoked by derived classes during the construction of type objects.

  Initializes a new instance of the class.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.Assembly

  A instance that describes the assembly containing the current type. For generic types, the instance describes the assembly that contains the definition of the generic type.

  If the current object represents a constructed generic type, this property returns the assembly that contains the generic type definition. For example, suppose you create an assembly named MyGenerics.dll that contains the generic type definition MyGenericStack<T> (MyGenericStack(Of T) in Visual Basic, generic<T> ref class MyGenericStack in C++). If you create an instance of MyGenericStack<int> (MyGenericStack(Of Integer) in Visual Basic) in another assembly, the property for the constructed type returns an object that represents MyGenerics.dll.

  Similarly, if the current object represents an unassigned generic parameter , this property returns the assembly that contains the generic type that defines .

  This property is read-only.

  Gets the in which the type is declared. For generic types, gets the in which the generic type is defined.

  1
  RuntimeInfrastructure
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  The assembly-qualified name of the , including the name of the assembly from which the was loaded. If the current object represents a generic parameter, this property returns .

  The assembly-qualified name of a type consists of the type name, including its namespace, followed by a comma, followed by the display name of the assembly. The display name of an assembly is obtained using the property.

  In the .NET Framework version 2.0, processor architecture is added to assembly identity, and can be specified as part of assembly name strings. For example, "ProcessorArchitecture=msil". However, it is not included in the string returned by the property, for compatibility reasons. See .

  All compilers that support the common language runtime emit the simple name of a nested class, and reflection constructs a mangled name when queried, in accordance with the following conventions.

  Delimiter

  Meaning

  Backslash (\)

  Escape character.

  Comma (,)

  Precedes the Assembly name.

  Plus sign (+)

  Precedes a nested class.

  Period (.)

  Denotes namespace identifiers.

  Brackets ([])

  After a type name, denotes an array of that type.

  -or-

  For a generic type, encloses the generic type argument list.

  -or-

  Within a type argument list, encloses an assembly-qualified type.

  For example, the assembly-qualified name for a class might look like this:

  `TopNamespace.SubNameSpace.ContainingClass+NestedClass, MyAssembly, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089`

  If the namespace contained a plus sign, for example TopNamespace.Sub+Namespace, then the plus sign (+) would be preceded by an escape character (\) to prevent it from being interpreted as a nesting separator. Reflection would emit this string as follows:

  `TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089`

  A "++" becomes "\+\+", and a "\" becomes "\\".

  This qualified name can be persisted and later used to load the . To search for and load a , use either with the type name only or with the assembly qualified type name. with the type name only will look for the in the caller's assembly and then in the System assembly. with the assembly qualified type name will look for the in any assembly.

  Type names may include trailing characters that denote additional information about the type, such as whether the type is a reference type, a pointer type or an array type. To retrieve the type name without these trailing characters, use t.GetElementType().ToString(), where is the type.

  Spaces are relevant in all type name components except the assembly name. In the assembly name, spaces before the ',' separator are relevant, but spaces after the ',' separator are ignored.

  Generic arguments of generic types are themselves qualified by assembly name. For example, in the assembly-qualified type name for MyGenericClass<int> (MyGenericClass(Of Integer) in Visual Basic), int is expanded to the assembly-qualified type name for .

  If the current object represents a generic parameter, this property returns null.

  Gets the assembly-qualified name of the , which includes the name of the assembly from which the was loaded.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.TypeAttributes

  A object representing the attribute set of the .

  If the current represents a constructed generic type, this property returns the attributes of the generic type definition. For example, the attributes returned for MyGenericClass<int> (MyGenericClass(Of Integer) in Visual Basic) are the attributes of MyGenericClass<T> (MyGenericClass(Of T) in Visual Basic).

  If the current represents a generic type parameter — that is, if the property returns true — the value returned by this property is unspecified.

  Gets the attributes associated with the .

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type

  A object representing the type from which the current directly inherits, or if the current represents the class.

  The following example demonstrates using the property.

  `using System; class TestType { public static void Main() { Type t = typeof(int); Console.WriteLine("{0} inherits from {1}", t,t.BaseType); } }`

  The output is

  System.Int32 inherits from System.ValueType

  The base type is the type from which the current type directly inherits. is the only type that does not have a base type, therefore null is returned as the base type of .

  Interfaces inherit from zero or more base interfaces; therefore, this property returns null if the Type object represents an interface. The base interfaces can be determined with or .

  If the current represents a constructed generic type, the base type reflects the generic arguments. For example, consider the following declarations:

  code reference: System.Type.BaseType#1

  For the constructed type C<int> (C(Of Integer) in Visual Basic), the property returns B<int>.

  If the current represents a type parameter of a generic type definition, returns the class constraint, that is, the class the type parameter must inherit. If there is no class constraint, returns .

  This property is read-only.

  Gets the type from which the current directly inherits.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.Boolean

  if a object contains unassigned generic parameters; otherwise .

  For an example of using this method, see the example for .

  In order to create an instance of a type, there must be no generic type definitions or open constructed types in the type arguments of the type itself, in any enclosing generic types, or in any elements of the type. Another way of saying this is that when examined recursively, the type must contain no generic type parameters.

  Since types can be arbitrarily complex, making this determination is difficult. For convenience and to reduce the chance of error, the property provides a standard way to distinguish between closed constructed types, which can be instantiated, and open constructed types, which cannot. If the property returns true, the type cannot be instantiated.

  The property searches recursively for type parameters. For example, it returns true for an array whose elements are type A<T> (A(Of T) in Visual Basic), even though the array is not itself generic. Contrast this with the behavior of the property, which returns false for arrays.

  For a set of example classes and a table showing the values of the property, see .

  Gets a value indicating whether the current object has type parameters that have not been replaced by specific types.

- Property
  2.0.0.0
  4.0.0.0
  System.Reflection.MethodBase

  If the current represents a type parameter of a generic method, a that represents the declaring method; otherwise .

  The declaring method is a generic method definition. That is, if does not return null, then DeclaringMethod.IsGenericMethodDefinition returns true.

  The and properties identify the generic type definition or generic method definition in which the generic type parameter was originally defined:

  If the property returns a , that represents a generic method definition, and the current object represents a type parameter of that generic method definition.

  If the property returns null, then the property always returns a object representing a generic type definition, and the current object represents a type parameter of that generic type definition.

  Getting the property on a type whose property is false throws an .

  The that is returned by the property is either a in the case of a generic method, or a in the case of a generic constructor.

  In the .NET Framework version 2.0, generic constructors are not supported.

  For a list of the invariant conditions for terms used in generic reflection, see the property remarks.

  Gets a that represents the declaring method, if the current represents a type parameter of a generic method.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type

  The object for the class that declares the type represented by the current instance. If the type is a nested type, this property returns the enclosing type; otherwise, returns the current instance.

  The following example demonstrates the property.

  `using System; using System.Reflection; public abstract class DeclaringTypeTest{ public abstract class MyClassA { public abstract int m(); } public abstract class MyClassB : MyClassA { } public static void Main() { Console.WriteLine("Declaring type of m is {0}", typeof(MyClassB).GetMethod("m").DeclaringType); } }`

  The output is

  Declaring type of m is DeclaringTypeTest+MyClassA

  If the current object represents a type parameter of a generic type, this property returns the generic type definition.

  If the current object represents a type parameter of a generic method, this property returns the type that contains the generic method definition. If the type is generic, the generic type definition is returned. That is, the following code returns the generic type definition of the generic class, which contains the generic method:

  code reference: System.Type.DeclaringType#1

  If the current represents a type parameter in the definition of a generic type or generic method, the and properties identify the generic type definition or generic method definition where the generic type parameter was originally defined:

  If the property returns a , that represents a generic method definition, and the current object represents a type parameter of that generic method definition.

  If the property returns null, then the property always returns a object representing a generic type definition, and the current object represents a type parameter of that generic type definition.

  Getting the property on a type whose property is false throws an .

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

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.Binder

  The default used by the system.

  The default binder provided with the common language runtime is applicable in all but the most specialized circumstances. If you need a binder that follows rules that differ from those of the supplied default binder, define a type derived from the class and pass an instance of that type using the parameter of one of the overloads.

  Reflection models the accessibility rules of the common type system. For example, if the caller is in the same assembly, the caller does not need special permissions for internal members. Otherwise, the caller needs . This is consistent with lookup of members that are protected, private, and so on.

  The general principle is that should perform only widening conversions, which never lose data. An example of a widening conversion is converting a value that is a 32-bit signed integer to a value that is a 64-bit signed integer. This is distinguished from a narrowing conversion, which may lose data. An example of a narrowing conversion is converting a 64-bit signed integer to a 32-bit signed integer.

  The following table lists the conversions supported by the default binder.

  Source Type

  Target Type

  Any type

  Its base type.

  Any type

  The interface it implements.

  Char

  Unt16, UInt32, Int32, UInt64, Int64, Single, Double

  Byte

  Char, Unt16, Int16, UInt32, Int32, UInt64, Int64, Single, Double

  SByte

  Int16, Int32, Int64, Single, Double

  UInt16

  UInt32, Int32, UInt64, Int64, Single, Double

  Int16

  Int32, Int64, Single, Double

  UInt32

  UInt64, Int64, Single, Double

  Int32

  Int64, Single, Double

  UInt64

  Single, Double

  Int64

  Single, Double

  Single

  Double

  Non-reference

  By-reference.

  Gets a reference to the default binder, which implements internal rules for selecting the appropriate members to be called by .

  1
  Reflection
- Field
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Char

  This field is read-only.

  Separates names in the namespace of the . This field is read-only.

  1
  Reflection
- Field
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type[]

  This field is read-only.

  The empty array returned by this field is used to specify that lookup methods in the class, such as and , search for members that do not take parameters. For example, to locate the public instance constructor that takes no parameters, invoke ( | , , , ).

  Represents an empty array of type . This field is read-only.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  This method overrides .

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

  true if the underlying system type of is the same as the underlying system type of the current ; otherwise, false. This method also returns false if the object specified by the parameter is not a Type.

  The object whose underlying system type is to be compared with the underlying system type of the current .
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean `` To be added.

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

  true if the underlying system type of is the same as the underlying system type of the current ; otherwise, false.

  The object whose underlying system type is to be compared with the underlying system type of the current . 1 Reflection
- Field
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberFilter

  This field holds a reference to the delegate used by the method. The method encapsulated by this delegate takes two parameters: the first is a object and the second is an Object. The method determines whether the MemberInfo object matches the criteria specified by the Object. The Object may be assigned the value of any one of the fields on the classes , , or .

  For example, the Object can be assigned the value of a field from FieldAttributes such as Public. In that case, when the FilterAttribute delegate is invoked, it will return true only if the method represented by the MemberInfo object is decorated with the public field attribute in metadata.

  Represents the member filter used on attributes. This field is read-only.

- Field
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberFilter

  This field holds a reference to the delegate used by the method. The method encapsulated by this delegate takes two parameters: the first is a object and the second is an Object. The method determines whether the MemberInfo object matches the criteria specified by the Object. The Object is assigned a string value, which may include a trailing "*" wildcard character. Only wildcard end string matching is supported.

  For example, the Object may be assigned the value "Byte*". In that case, when the FilterName delegate is invoked, it will return true only if the method represented by the MemberInfo object has a name that begins with "Byte".

  Represents the case-sensitive member filter used on names. This field is read-only.

- Field
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberFilter

  This field holds a reference to the delegate used by the method. The method encapsulated by this delegate takes two parameters: the first is a object and the second is an Object. The method determines whether the MemberInfo object matches the criteria specified by the Object. The Object is assigned a string value, which may include a trailing "*" wildcard character. Only wildcard end string matching is supported.

  For example, the Object may be assigned the value "ByTe*". In that case, when the FilterName delegate is invoked, it will return true only if the method represented by the MemberInfo object has a name that begins with "byte", ignoring case.

  Represents the case-insensitive member filter used on names. This field is read-only.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type[] `` ``

  This method can be overridden by a derived class.

  The and delegates supplied by the class may also be used, in lieu of the delegate.

  All of the interfaces implemented by this class are considered during the search, whether declared by a base class or this class itself.

  This method searches the base class hierarchy, returning each of the matching interfaces each class implements as well as all the matching interfaces each of those interfaces implements (that is, the transitive closure of the matching interfaces is returned). No duplicate interfaces are returned.

  If the current represents a type parameter in the definition of a generic type or generic method, searches all the interfaces declared in the constraints on the type parameter, and all interfaces inherited through the interfaces declared in the constraints. If the current represents a type argument of a generic type, searches all the interfaces implemented by the type, whether or not they match constraints.

  can return generic interfaces, even on types that are not generic. For example, a nongeneric type might implement IEnumerable<int> (IEnumerable(Of Integer) in Visual Basic).

  Returns an array of objects representing a filtered list of interfaces implemented or inherited by the current .

  An array of objects representing a filtered list of the interfaces implemented or inherited by the current , or an empty array of type if no interfaces matching the filter are implemented or inherited by the current .

  The delegate that compares the interfaces against . The search criteria that determines whether an interface should be included in the returned array.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberInfo[] `` `` `` ``

  This method can be overridden by a derived class.

  Members include properties, methods, fields, events, and so on.

  The following filter flags can be used to define which members to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Instance to include instance members in the search.

  Specify BindingFlags.Static to include static members in the search.

  Specify BindingFlags.Public to include public members in the search.

  Specify BindingFlags.NonPublic to include non-public members (that is, private, internal, and protected members) in the search.

  The following modifier flags can be used to change how the search works:

  BindingFlags.DeclaredOnly to search only the members declared on the , not members that were simply inherited.

  See for more information.

  Valid values for are defined in . If no such members are found, an empty array is returned.

  To get the class initializer (.cctor) using this method, you must specify | ( Or in Visual Basic). You can also get the class initializer using the property.

  If the current represents a type parameter of a generic type or generic method, processes any members declared by the class constraint and the interface constraints of the type parameter.

  Returns a filtered array of objects of the specified member type.

  A filtered array of objects of the specified member type.

  -or-

  An empty array of type , if the current does not have members of type that match the filter criteria.

  An object that indicates the type of member to search for. A bitmask comprised of one or more that specify how the search is conducted. The delegate that does the comparisons, returning true if the member currently being inspected matches the and false otherwise. You can use the FilterAttribute, FilterName, and FilterNameIgnoreCase delegates supplied by this class. The first uses the fields of FieldAttributes, MethodAttributes, and MethodImplAttributes as search criteria, and the other two delegates use String objects as the search criteria. The search criteria that determines whether a member is returned in the array of MemberInfo objects.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the fully qualified name of the .

  The following example demonstrates using the property.

  `using System; class TestType { public static void Main() { Type t = typeof(Array); Console.WriteLine("Full name of Array type is {0}",t.FullName); } }`

  The output is

  Full name of Array type is System.Array

  For example, the fully qualified name of the C# string type is System.String. Contrast this with the assembly-qualified name, which is the full name plus the assembly, provided by the property.

  If the current represents a generic type, the type arguments in the string returned by are qualified by their assembly, version, and so on, even though the string representation of the generic type itself is not qualified by assembly. Thus, concatenating t.FullName + ", " + t.Assembly.FullName produces a result that is equivalent to t.AssemblyQualifiedName, as is the case with types that are not generic.

  If the current represents a type parameter of a generic type, or an array type, pointer type, or byref type based on a type parameter, this property returns null.

  If the current type contains generic type parameters that have not been replaced by specific types (that is, the property returns true), but the type is not a generic type definition (that is, the property returns false), this property returns null. For example, consider the classes Base and Derived in the following code.

  code reference: System.Type.FullName#1

  If you use the property to obtain the base type of Derived, the property of the resulting object returns null. To get a non-null , you can use the method to get the generic type definition.

  This property is read-only.

  Gets the fully qualified name of the , including the namespace of the but not the assembly.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.Reflection.GenericParameterAttributes

  A value that describes the variance and special constraints of the current generic type parameter.

  The current object is not a generic type parameter. That is, the property returns .

  The value of this property contains flags that describe whether the current generic type parameter is covariant, and flags that describe any special constraints. Use the value to select the covariance flags, and use the value to select the constraint flags.

  For a list of the invariant conditions for terms used in generic reflection, see the property remarks.

  Gets a combination of flags that describe the covariance and special constraints of the current generic type parameter.

- Property
  2.0.0.0
  4.0.0.0
  System.Int32

  A zero-based integer representing the position of a type parameter in the type parameter list of the generic type or generic method that declared the parameter.

  The current type does not represent a type parameter. That is, returns .

  The following example defines a generic class with two type parameters, and a generic class that derives from it. The base class of the derived type has one unbound type parameter and one type parameter bound to . The example displays information about these generic classes, including the positions reported by .

  `using System; using System.Reflection; using System.Collections.Generic; // Define a base class with two type parameters. public class Base<T, U> { } // Define a derived class. The derived class inherits from a constructed // class that meets the following criteria: // (1) Its generic type definition is Base<T, U>. // (2) It specifies int for the first type parameter. // (3) For the second type parameter, it uses the same type that is used // for the type parameter of the derived class. // Thus, the derived class is a generic type with one type parameter, but // its base class is an open constructed type with one type argument and // one type parameter. public class Derived<V>: Base<int,V> { } public class Test { public static void Main() { Console.WriteLine("\n--- Display a generic type and the open constructed"); Console.WriteLine(" type from which it is derived."); // Create a Type object representing the generic type Derived. // Type derivedType = Type.GetType("Derived"); DisplayGenericTypeInfo(derivedType); // Display its open constructed base type. DisplayGenericTypeInfo(derivedType.BaseType); } private static void DisplayGenericTypeInfo(Type t) { Console.WriteLine("\n{0}", t); Console.WriteLine("\tIs this a generic type definition? {0}", t.IsGenericTypeDefinition); Console.WriteLine("\tDoes it have generic arguments? {0}", t.HasGenericArguments); Console.WriteLine("\tDoes it have unbound generic parameters? {0}", t.ContainsGenericParameters); if (t.HasGenericArguments) { // If the type is a generic type definition or a // constructed type, display the type arguments. // Type[] typeArguments = t.GetGenericArguments(); Console.WriteLine("\tList type arguments ({0}):", typeArguments.Length); foreach (Type tParam in typeArguments) { // IsGenericParameter is true only for generic type // parameters. // if (tParam.IsGenericParameter) { Console.WriteLine("\t\t{0} (unbound - parameter position {1})", tParam, tParam.GenericParameterPosition); } else { Console.WriteLine("\t\t{0}", tParam); } } } else { Console.WriteLine("\tThis is not a generic or constructed type."); } } } /* This example produces the following output: --- Display a generic type and the open constructed type from which it is derived. Derived[V] Is this a generic type definition? True Does it have generic arguments? True Does it have unbound generic parameters? True List type arguments (1): V (unbound - parameter position 0) Base[System.Int32, V] Is this a generic type definition? False Does it have generic arguments? True Does it have unbound generic parameters? True List type arguments (2): System.Int32 V (unbound - parameter position 0) */`

  The property returns the position of a type parameter in the parameter list of the generic type definition or generic method definition where the type parameter was originally defined. The and properties identify the generic type or method definition:

  If the property returns a , that represents a generic method definition, and the current object represents a type parameter of that generic method definition.

  If the property returns null, then the property always returns a object representing a generic type definition, and the current object represents a type parameter of that generic type definition.

  To provide the correct context for the value of the property, it is necessary to identify the generic type or method a type parameter belongs to. For example, consider the return value of the generic method GetSomething in the following code:

  code reference: System.Type.GenericParameterPosition#1

  The type returned by GetSomething depends on the type arguments supplied to class A and to GetSomething itself. You can obtain a for GetSomething, and from that you can obtain the return type. When you examine the type parameters of the return type, returns 0 for both. The position of V is 0 because V is the first type parameter in the type parameter list for class A. The position of X is 0 because X is the first type parameter in the type parameter list for GetSomething.

  Calling the property causes an exception if the current does not represent a type parameter. When you examine the type arguments of an open constructed type, use the property to tell which are type parameters and which are types. The property returns true for a type parameter; you can then use the method to obtain its position and use the and properties to determine the generic method or type definition that defines it.

  Gets the position of the type parameter in the type parameter list of the generic type or method that declared the parameter, when the object represents a type parameter of a generic type or a generic method.

- Property
  4.0.0.0
  System.Type[] To be added.

  This property gets only the generic type arguments; that is, the types that have been specified for the generic type parameters of the current type. If the current type is a generic type definition, this property returns an empty array.

  If a generic type is used in a generic method or in another generic type, some of its generic type arguments might be generic type parameters of the enclosing method or type.

  To get the generic type parameters of a type that represents a generic type definition, use the property. To get a object for the current object, use the extension method.

  Gets an array of the generic type arguments for this type.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 To be added. The current is not an array.

  Gets the number of dimensions in an .

  An containing the number of dimensions in the current Type.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.TypeAttributes

  This property is read-only.

  This method returns a value that indicates the attributes set in the metadata of the type represented by the current instance.

  Use this property to determine the visibility, semantics, and layout format of the type represented by the current instance. Also use this property to determine if the type represented by the current instance has a special name.

  When overridden in a derived class, implements the property and gets a bitmask indicating the attributes associated with the .

  A object representing the attribute set of the .

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
  System.Reflection.ConstructorInfo ``

  is , or at least one of the elements in is .

  has more than one dimension.

  Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  This method overload looks for public instance constructors and cannot be used to obtain a class initializer (.cctor). To get a class initializer, use an overload that takes , and specify | ( Or in Visual Basic). You can also get the class initializer using the property.

  If the requested constructor is non-public, this method returns null.

  You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

  If the current represents a constructed generic type, this method returns the with the type parameters replaced by the appropriate type arguments. If the current represents a type parameter in the definition of a generic type or generic method, this method always returns null.

  Searches for a public instance constructor whose parameters match the types in the specified array.

  An object representing the public instance constructor whose parameters match the types in the parameter type array, if found; otherwise, null.

  An array of objects representing the number, order, and type of the parameters for the desired constructor. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
  System.Reflection.ConstructorInfo `` `` `` ``

  is , or at least one of the elements in is .

  has more than one dimension.

  Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  If an exact match does not exist, the will attempt to coerce the parameter types specified in the array in order to select a match. If the is unable to select a match, then null is returned.

  The following filter flags can be used to define which constructors to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public constructors in the search.

  Specify BindingFlags.NonPublic to include non-public constructors (that is, private, internal, and protected constructors) in the search.

  See for more information.

  To get the class initializer (.cctor) using this method overload, you must specify | ( Or in Visual Basic). You can also get the class initializer using the property.

  You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

  If the current represents a constructed generic type, this method returns the with the type parameters replaced by the appropriate type arguments. If the current represents a type parameter in the definition of a generic type or generic method, this method always returns null.

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

  A object representing the constructor that matches the specified requirements, if found; otherwise, null.

  A bitmask comprised of one or more that specify how the search is conducted. An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. An array of objects representing the number, order, and type of the parameters for the constructor to get. An array of objects representing the attributes associated with the corresponding element in the parameter type array. The default binder does not process this parameter. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
  System.Reflection.ConstructorInfo `` `` `` `` ``

  Although the default binder does not process (the parameter), you can use the abstract class to write a custom binder that does process . ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

  If an exact match does not exist, the will attempt to coerce the parameter types specified in the array in order to select a match. If the is unable to select a match, then null is returned.

  The following filter flags can be used to define which constructors to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public constructors in the search.

  Specify BindingFlags.NonPublic to include non-public constructors (that is, private, internal, and protected constructors) in the search.

  See for more information.

  To get the class initializer (.cctor) using this method, you must specify | ( Or in Visual Basic). You can also get the class initializer using the property.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

  If the current represents a constructed generic type, this method returns the with the type parameters replaced by the appropriate type arguments. If the current represents a type parameter in the definition of a generic type or generic method, this method always returns null.

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

  An object representing the constructor that matches the specified requirements, if found; otherwise, null.

  A bitmask comprised of one or more that specify how the search is conducted. An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. The object that specifies the set of rules to use regarding the order and layout of arguments, how the return value is passed, what registers are used for arguments, and the stack is cleaned up. An array of objects representing the number, order, and type of the parameters for the constructor to get. An array of objects representing the attributes associated with the corresponding element in the array. The default binder does not process this parameter.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.ConstructorInfo `` `` `` `` ``

  Although the default binder does not process (the parameter), you can use the abstract class to write a custom binder that does process . ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

  If an exact match does not exist, the will attempt to coerce the parameter types specified in the array in order to select a match. If the is unable to select a match, then null is returned.

  The following filter flags can be used to define which constructors to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public constructors in the search.

  Specify BindingFlags.NonPublic to include non-public constructors (that is, private, internal, and protected constructors) in the search.

  See for more information.

  This method implements .

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

  A object representing the constructor that matches the specified requirements, if found; otherwise, null.

  A bitmask comprised of one or more that specify how the search is conducted. An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. The object that specifies the set of rules to use regarding the order and layout of arguments, how the return value is passed, what registers are used for arguments, and the stack is cleaned up. An array of objects representing the number, order, and type of the parameters for the constructor to get. An array of objects representing the attributes associated with the corresponding element in the array. The default binder does not process this parameter.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
  System.Reflection.ConstructorInfo[]

  The method does not return constructors in a particular order, such as declaration order. Your code must not depend on the order in which constructors are returned, because that order varies.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  This method overload calls the method overload, with | ( Or in Visual Basic). It will not find class initializers (.cctor). To find class initializers, use an overload that takes , and specify | ( Or in Visual Basic). You can also get the class initializer using the property.

  If the current represents a constructed generic type, this method returns the objects with the type parameters replaced by the appropriate type arguments. For example, if class C<T> has a constructor C(T t1) (Sub New(ByVal t1 As T) in Visual Basic), calling on C<int> returns a that represents C(int t1) in C# (Sub New(ByVal t1 As Integer) in Visual Basic).

  If the current represents a generic type parameter, the method returns an empty array.

  Returns all the public constructors defined for the current .

  An array of objects representing all the public instance constructors defined for the current , but not including the type initializer (static constructor). If no public instance constructors are defined for the current , or if the current represents a type parameter in the definition of a generic type or generic method, an empty array of type is returned.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
  System.Reflection.ConstructorInfo[] `` Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  The method does not return constructors in a particular order, such as declaration order. Your code must not depend on the order in which constructors are returned, because that order varies.

  can be used to specify whether to return only public constructors or both public and non-public constructors.

  If an exact match does not exist, the will attempt to coerce the parameter types specified in the array in order to select a match. If the is unable to select a match, then null is returned.

  The following filter flags can be used to define which constructors to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public constructors in the search.

  Specify BindingFlags.NonPublic to include non-public constructors (that is, private, internal, and protected constructors) in the search. Constructors of base classes are not returned.

  See for more information.

  To get the class initializer (.cctor) using this method overload, you must specify | ( Or in Visual Basic). You can also get the class initializer using the property.

  If the current represents a constructed generic type, this method returns the objects with the type parameters replaced by the appropriate type arguments. For example, if class C<T> has a constructor C(T t1) (Sub New(ByVal t1 As T) in Visual Basic), calling on C<int> returns a that represents C(int t1) in C# (Sub New(ByVal t1 As Integer) in Visual Basic).

  If the current represents a generic type parameter, the method returns an empty array.

  When overridden in a derived class, searches for the constructors defined for the current , using the specified BindingFlags.

  An array of objects representing all constructors defined for the current that match the specified binding constraints, including the type initializer if it is defined. Returns an empty array of type if no constructors are defined for the current , if none of the defined constructors match the binding constraints, or if the current represents a type parameter in the definition of a generic type or generic method.

  A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberInfo[]

  The method does not return members in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which members are returned, because that order varies.

  This method can be overridden by a derived class.

  Members include properties, methods, fields, events, and so on.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  If the current represents a constructed generic type, this method returns the objects with the type parameters replaced by the appropriate type arguments. For example, if class C<T> has a property P that returns T, calling on C<int> returns int P in C# (Property P As Integer in Visual Basic).

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the members of the class constraint, or the members of if there is no class constraint.

  Searches for the members defined for the current whose is set.

  An array of objects representing all default members of the current .

  -or-

  An empty array of type , if the current does not have default members.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type

  The following example demonstrates the method.

  `using System; class TestType { public static void Main() { int[] array = {1,2,3}; Type t = array.GetType(); Type t2 = t.GetElementType(); Console.WriteLine("{0} element type is {1}",array, t2.ToString()); TestType newMe = new TestType(); t = newMe.GetType(); t2 = t.GetElementType(); Console.WriteLine("{0} element type is {1}", newMe, t2==null? "null" : t2.ToString()); } }`

  The output is

  System.Int32[] element type is System.Int32

  TestType element type is null

  This method returns null for the class.

  When overridden in a derived class, returns the of the object encompassed or referred to by the current array, pointer or reference type.

  The of the object encompassed or referred to by the current array, pointer, or reference type, or null if the current is not an array or a pointer, or is not passed by reference, or represents a generic type or a type parameter in the definition of a generic type or generic method.

  0
- Method
  4.0.0.0
  System.String `` To be added.

  Returns the name of the constant that has the specified value, for the current enumeration type.

  The name of the member of the current enumeration type that has the specified value, or null if no such constant is found.

  The value whose name is to be retrieved.
- Method
  4.0.0.0
  System.String[]

  The elements of the return value array are sorted by the binary values (that is, the unsigned values) of the enumerated constants. If the array contains enumerated constants with the same value, the order of their corresponding names is unspecified.

  Returns the names of the members of the current enumeration type.

  An array that contains the names of the members of the enumeration.

- Method
  4.0.0.0
  System.Type

  By default, the underlying type of an enumeration in C# and Visual Basic is . Other integer types can be specified.

  Returns the underlying type of the current enumeration type.

  The underlying type of the current enumeration.

- Method
  4.0.0.0
  System.Array To be added.

  Returns an array of the values of the constants in the current enumeration type.

  An array that contains the values. The elements of the array are sorted by the binary values (that is, the unsigned values) of the enumeration constants.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.EventInfo `` is .

  An event is considered public to reflection if it has at least one method or accessor that is public. Otherwise the event is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

  The search for is case-sensitive. The search includes public static and public instance events.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the events of the class constraint.

  Returns the object representing the specified public event.

  The object representing the specified public event that is declared or inherited by the current , if found; otherwise, null.

  The string containing the name of an event that is declared or inherited by the current . 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.EventInfo `` `` is . Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  The following filter flags can be used to define which events to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public events in the search.

  Specify BindingFlags.NonPublic to include non-public events (that is, private, internal, and protected events) in the search.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the events declared on the , not events that were simply inherited.

  See for more information.

  An event is considered public to reflection if it has at least one method or accessor that is public. Otherwise the event is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the events of the class constraint.

  When overridden in a derived class, returns the object representing the specified event, using the specified binding constraints.

  The object representing the specified event that is declared or inherited by the current , if found; otherwise, null.

  The string containing the name of an event which is declared or inherited by the current . A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.EventInfo[]

  An event is considered public to reflection if it has at least one method or accessor that is public. Otherwise the event is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

  The method does not return events in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which events are returned, because that order varies.

  This method can be overridden by a derived class.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the events of the class constraint.

  Returns all the public events that are declared or inherited by the current .

  An array of objects representing all the public events which are declared or inherited by the current .

  -or-

  An empty array of type , if the current does not have public events.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.EventInfo[] `` Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  The method does not return events in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which events are returned, because that order varies.

  The following filter flags can be used to define which events to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public events in the search.

  Specify BindingFlags.NonPublic to include non-public events (that is, private, internal, and protected events) in the search. Only protected and internal events on base classes are returned; private events on base classes are not returned.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.DeclaredOnly to search only the events declared on the , not events that were simply inherited.

  See for more information.

  An event is considered public to reflection if it has at least one method or accessor that is public. Otherwise the event is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the events of the class constraint.

  When overridden in a derived class, searches for events that are declared or inherited by the current , using the specified binding constraints.

  An array of objects representing all events that are declared or inherited by the current that match the specified binding constraints.

  -or-

  An empty array of type , if the current does not have events, or if none of the events match the binding constraints.

  A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.FieldInfo `` is . Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  The search for is case-sensitive. The search includes public static and public instance fields.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the fields of the class constraint.

  Searches for the public field with the specified name.

  An object representing the public field with the specified name, if found; otherwise, null.

  The string containing the name of the data field to get. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.FieldInfo `` `` is . Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  The following filter flags can be used to define which fields to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public fields in the search.

  Specify BindingFlags.NonPublic to include non-public fields (that is, private, internal, and protected fields) in the search.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the fields declared on the , not fields that were simply inherited.

  See for more information.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the fields of the class constraint.

  Searches for the specified field, using the specified binding constraints.

  An object representing the field that matches the specified requirements, if found; otherwise, null.

  The string containing the name of the data field to get. A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.FieldInfo[]

  The method does not return fields in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which fields are returned, because that order varies.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the public fields of the class constraint.

  Returns all the public fields of the current .

  An array of objects representing all the public fields defined for the current .

  -or-

  An empty array of type , if no public fields are defined for the current .

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.FieldInfo[] `` Requires permission to retrieve information on non-public members of a type in loaded assemblies. See .

  The method does not return fields in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which fields are returned, because that order varies.

  The following filter flags can be used to define which fields to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public fields in the search.

  Specify BindingFlags.NonPublic to include non-public fields (that is, private, internal, and protected fields) in the search. Only protected and internal fields on base classes are returned; private fields on base classes are not returned.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.DeclaredOnly to search only the fields declared on the , not fields that were simply inherited.

  See for more information.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the public fields of the class constraint.

  When overridden in a derived class, searches for the fields defined for the current , using the specified binding constraints.

  An array of objects representing all fields defined for the current that match the specified binding constraints.

  -or-

  An empty array of type , if no fields are defined for the current , or if none of the defined fields match the binding constraints.

  A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  2.0.0.0
  4.0.0.0
  System.Type[]

  For an example of using this method, see the example for .

  The array elements are returned in the order in which they appear in the list of type arguments for the generic type.

  If the current type is a closed constructed type (that is, the property returns false), the array returned by the method contains the types that have been assigned to the generic type parameters of the generic type definition.

  If the current type is a generic type definition, the array contains the type parameters.

  If the current type is an open constructed type (that is, the property returns true) in which specific types have not been assigned to all of the type parameters and type parameters of enclosing generic types or methods, the array contains both types and type parameters. Use the property to tell them apart. For a demonstration of this scenario, see the code example for the property.

  For a list of the invariant conditions for terms used in generic reflection, see the property remarks.

  Returns an array of objects that represent the type arguments of a generic type or the type parameters of a generic type definition.

  An array of objects that represent the type arguments of a generic type. Returns an empty array if the current type is not a generic type.

- Method
  2.0.0.0
  4.0.0.0
  System.Type[] The current object is not a generic type parameter. That is, the property returns .

  Each constraint on a generic type parameter is expressed as a object. Use the property to determine whether a constraint is the base class constraint; if the property returns false, the constraint is an interface constraint. If a type parameter has no class constraint and no interface constraints, an empty array is returned.

  For a list of the invariant conditions for terms used in generic reflection, see the property remarks.

  Returns an array of objects that represent the constraints on the current generic type parameter.

  An array of objects that represent the constraints on the current generic type parameter.

- Method
  2.0.0.0
  4.0.0.0
  System.Type The current type is not a generic type. That is, returns .

  For an example of using this method, see the example for .

  A generic type definition is a template from which other types can be constructed. For example, from the generic type definition G<T> (expressed in C# syntax; G(Of T) in Visual Basic or generic <typename T> ref class G in C++) you can construct and instantiate the type G<int> (G(Of Integer) in Visual Basic). Given a object representing this constructed type, the method returns the generic type definition.

  If two constructed types are created from the same generic type definition, using the same type arguments, the method returns the same object for both types.

  If you call the method on a object that already represents a generic type definition, it returns the current .

  An array of generic types is not itself generic. In the C# code A<int>[] v; or the Visual Basic code Dim v() As A(Of Integer), the type of variable v is not generic. Use to determine whether a type is generic before calling .

  For a list of the invariant conditions for terms used in generic reflection, see the property remarks.

  Returns a object that represents a generic type definition from which the current generic type can be constructed.

  A object representing a generic type from which the current type can be constructed.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  This method overrides .

  Returns the hash code for this instance.

  The hash code for this instance.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` is . The current instance represents a type that implements the same generic interface with different type arguments.

  The search for is case-sensitive.

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

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

  For generic interfaces, the parameter is the mangled name, ending with a grave accent (`) and the number of type parameters. This is true for both generic interface definitions and constructed generic interfaces. For example, to find IExample<T> (IExample(Of T) in Visual Basic) or IExample<string> (IExample(Of String) in Visual Basic), search for "IExample`1".

  Searches for the interface with the specified name.

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

  The string containing the name of the interface to get. For generic interfaces, this is the mangled name. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` `` is . The current instance represents a type that implements the same generic interface with different type arguments.

  The parameter applies only to the simple interface name, not to the namespace. The portion of that specifies the namespace must have the correct case, or the interface will not be found. For example, the string "System.icomparable" finds the interface, but the string "system.icomparable" does not.

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

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

  For generic interfaces, the parameter is the mangled name, ending with a grave accent (`) and the number of type parameters. This is true for both generic interface definitions and constructed generic interfaces. For example, to find IExample<T> (IExample(Of T) in Visual Basic) or IExample<string> (IExample(Of String) in Visual Basic), search for "IExample`1".

  When overridden in a derived class, searches for the specified interface, specifying whether to do a case-insensitive search for the interface name.

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

  The string containing the name of the interface to get. For generic interfaces, this is the mangled name. true to ignore the case of that part of that specifies the simple interface name (the part that specifies the namespace must be correctly cased). 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
  System.Reflection.InterfaceMapping ``

  The interface map denotes how an interface is mapped into the actual methods on a class that implements that interface.

  If the current represents a constructed generic type, type parameters are replaced by the appropriate type arguments in the elements of the returned by this method.

  Returns an interface mapping for the specified interface type.

  An object that represents the interface mapping for .

  The interface type to retrieve a mapping for.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type[]

  The method does not return interfaces in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which interfaces are returned, because that order varies.

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

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

  When overridden in a derived class, gets all the interfaces implemented or inherited by the current .

  An array of objects representing all the interfaces implemented or inherited by the current .

  -or-

  An empty array of type , if no interfaces are implemented or inherited by the current .

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberInfo[] `` is .

  The search for is case-sensitive. The search includes public static and public instance members.

  Members include properties, methods, fields, events, and so on.

  The method does not return members in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which members are returned, because that order varies.

  This method overload will not find class initializers (.cctor). To find class initializers, use an overload that takes , and specify | ( Or in Visual Basic). You can also get the class initializer using the property.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the members of the class constraint, or the members of if there is no class constraint.

  For generic methods, do not include the type arguments in . For example, the C# code GetMember("MyMethod<int>") searches for a member with the text name "MyMethod<int>", rather than for a method named MyMethod that has one generic argument of type int.

  Searches for the public members with the specified name.

  An array of objects representing the public members with the specified name, if found; otherwise, an empty array.

  The string containing the name of the public members to get. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberInfo[] `` `` is . Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  This method can be overridden by a derived class.

  Members include properties, methods, fields, events, and so on.

  The method does not return members in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which members are returned, because that order varies.

  The following filter flags can be used to define which members to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public members in the search.

  Specify BindingFlags.NonPublic to include non-public members (that is, private, internal, and protected members) in the search.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the members declared on the , not members that were simply inherited.

  See for more information.

  To get the class initializer (.cctor) using this method overload, you must specify ".cctor" for , and | ( Or in Visual Basic) for . You can also get the class initializer using the property.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the members of the class constraint, or the members of if there is no class constraint.

  For generic methods, do not include the type arguments in . For example, the C# code GetMember("MyMethod<int>") searches for a member with the text name "MyMethod<int>", rather than for a method named MyMethod that has one generic argument of type int.

  Searches for the specified members, using the specified binding constraints.

  An array of objects representing the public members with the specified name, if found; otherwise, an empty array.

  The string containing the name of the members to get. A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberInfo[] `` `` ``

  Members include properties, methods, fields, events, and so on.

  The method does not return members in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which members are returned, because that order varies.

  The following filter flags can be used to define which members to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public members in the search.

  Specify BindingFlags.NonPublic to include non-public members (that is, private, internal, and protected members) in the search.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the members declared on the , not members that were simply inherited.

  See for more information.

  To get the class initializer (.cctor) using this method overload, you must specify ".cctor" for , for , and | ( Or in Visual Basic) for . You can also get the class initializer using the property.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the members of the class constraint, or the members of if there is no class constraint.

  For generic methods, do not include the type arguments in . For example, the C# code GetMember("MyMethod<int>") searches for a member with the text name "MyMethod<int>", rather than for a method named MyMethod that has one generic argument of type int.

  Searches for the specified members of the specified member type, using the specified binding constraints.

  An array of objects representing the public members with the specified name, if found; otherwise, an empty array.

  The string containing the name of the members to get. The value to search for. A bitmask comprised of one or more that specify how the search is conducted.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberInfo[]

  Members include properties, methods, fields, events, and so on.

  The method does not return members in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which members are returned, because that order varies.

  This method overload calls the method overload, with | | ( Or Or in Visual Basic). It will not find class initializers (.cctor). To find class initializers, use an overload that takes , and specify | ( Or in Visual Basic). You can also get the class initializer using the property.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the members of the class constraint, or the members of if there is no class constraint.

  Returns all the public members of the current .

  An array of objects representing all the public members of the current .

  -or-

  An empty array of type , if the current does not have public members.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberInfo[] `` Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  Members include properties, methods, fields, events, and so on.

  The method does not return members in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which members are returned, because that order varies.

  The following filter flags can be used to define which members to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public members in the search.

  Specify BindingFlags.NonPublic to include non-public members (that is, private, internal, and protected members) in the search. Only protected and internal members on base classes are returned; private members on base classes are not returned.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.DeclaredOnly to search only the members declared on the , not members that were simply inherited.

  Calling this method with only the Public flag or only the NonPublic flag will return the specified members and does not require any other flags.

  See for more information.

  To get the class initializer (.cctor) using this method overload, you must specify | ( Or in Visual Basic). You can also get the class initializer using the property.

  If the current T:System.Type represents a constructed generic type, this method returns the objects with the type parameters replaced by the appropriate type arguments.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the members of the class constraint, or the members of if there is no class constraint.

  When overridden in a derived class, searches for the members defined for the current , using the specified binding constraints.

  An array of objects representing all members defined for the current that match the specified binding constraints.

  -or-

  An empty array of type , if no members are defined for the current , or if none of the defined members match the binding constraints.

  A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MethodInfo `` More than one method matching the specified criteria was found. is .

  The search for is case-sensitive. The search includes public static and public instance methods.

  You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

  If the current T:System.Type represents a constructed generic type, this method returns the with the type parameters replaced by the appropriate type arguments.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the methods of the class constraint, or the methods of if there is no class constraint.

  For generic methods, do not include the type arguments in . For example, the C# code GetMember("MyMethod<int>") searches for a member with the text name "MyMethod<int>", rather than for a method named MyMethod that has one generic argument of type int.

  Searches for the public method with the specified name.

  An object that represents the public method with the specified name, if found; otherwise, null.

  The string containing the name of the public method to get. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MethodInfo `` `` More than one method matching the specified criteria was found. is . Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  The following filter flags can be used to define which methods to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public methods in the search.

  Specify BindingFlags.NonPublic to include non-public methods (that is, private, internal, and protected methods) in the search.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the methods declared on the , not methods that were simply inherited.

  See for more information.

  You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

  If the current T:System.Type represents a constructed generic type, this method returns the with the type parameters replaced by the appropriate type arguments.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the methods of the class constraint, or the methods of if there is no class constraint.

  For generic methods, do not include the type arguments in . For example, the C# code GetMember("MyMethod<int>") searches for a member with the text name "MyMethod<int>", rather than for a method named MyMethod that has one generic argument of type int.

  Searches for the specified method, using the specified binding constraints.

  An object representing the method that matches the specified requirements, if found; otherwise, null.

  The string containing the name of the method to get. A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MethodInfo `` `` More than one method matching the specified criteria was found.

  or is .

  -or-

  At least one of the elements in is .

  has more than one dimension.

  The search for is case-sensitive. The search includes public static and public instance methods.

  You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

  If the current T:System.Type represents a constructed generic type, this method returns the with the type parameters replaced by the appropriate type arguments.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the methods of the class constraint, or the methods of if there is no class constraint.

  The parameter cannot include type arguments. For example, the C# code GetMethod("MyGenericMethod<int>") searches for a method with the text name "MyGenericMethod<int>", rather than for a method named MyGenericMethod that has one generic argument of type int. Instead, use GetMethod("MyGenericMethod") with the appropriate parameter in the array.

  Searches for the specified public method whose parameters match the specified argument types.

  An object representing the public method whose parameters match the specified argument types, if found; otherwise, null.

  The string containing the name of the public method to get. An array of objects representing the number, order, and type of the parameters for the method to get. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MethodInfo `` `` `` More than one method matching the specified criteria was found.

  or is .

  -or-

  At least one of the elements in is .

  has more than one dimension.

  Although the default binder does not process (the parameter), you can use the abstract class to write a custom binder that does process . ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

  The search for is case-sensitive. The search includes public static and public instance methods.

  You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

  If the current T:System.Type represents a constructed generic type, this method returns the with the type parameters replaced by the appropriate type arguments.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the methods of the class constraint, or the methods of if there is no class constraint.

  For generic methods, do not include the type arguments in . For example, the C# code GetMethod("MyMethod<int>") searches for a member with the text name "MyMethod<int>", rather than for a method named MyMethod that has one generic argument of type int. Instead, use GetMethod("MyMethod") with the appropriate parameter in the array.

  Searches for the specified public method whose parameters match the specified argument types and modifiers.

  An object representing the public method that matches the specified requirements, if found; otherwise, null.

  The string containing the name of the public method to get. An array of objects representing the number, order, and type of the parameters for the method to get. An array of objects representing the attributes associated with the corresponding element in the array. To be only used when calling through COM interop, and only parameters that are passed by reference are handled. The default binder does not process this parameter. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MethodInfo `` `` `` `` `` More than one method matching the specified criteria was found.

  or is .

  -or-

  At least one of the elements in is .

  has more than one dimension.

  Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  Although the default binder does not process (the parameter), you can use the abstract class to write a custom binder that does process . ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

  The following filter flags can be used to define which methods to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public methods in the search.

  Specify BindingFlags.NonPublic to include nonpublic methods (that is, private, internal, and protected methods) in the search.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the methods declared on the , not methods that were simply inherited.

  See for more information.

  You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

  If the current T:System.Type represents a constructed generic type, this method returns the with the type parameters replaced by the appropriate type arguments.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the methods of the class constraint, or the methods of if there is no class constraint.

  For generic methods, do not include the type arguments in . For example, the C# code GetMember("MyMethod<int>") searches for a member with the text name "MyMethod<int>", rather than for a method named MyMethod that has one generic argument of type int.

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

  An object representing the method that matches the specified requirements, if found; otherwise, null.

  The string containing the name of the method to get. A bitmask comprised of one or more that specify how the search is conducted. An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. An array of objects representing the number, order, and type of the parameters for the method to get. An array of objects representing the attributes associated with the corresponding element in the array. To be only used when calling through COM interop, and only parameters that are passed by reference are handled. The default binder does not process this parameter. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MethodInfo `` `` `` `` `` ``

  Although the default binder does not process (the parameter), you can use the abstract class to write a custom binder that does process . ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

  The following table shows what members of a base class are returned by the GetXXX methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  The following filter flags can be used to define which methods to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public methods in the search.

  Specify BindingFlags.NonPublic to include nonpublic methods (that is, private, internal, and protected methods) in the search.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the methods declared on the , not methods that were simply inherited.

  See for more information.

  You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

  If the current T:System.Type represents a constructed generic type, this method returns the with the type parameters replaced by the appropriate type arguments.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the methods of the class constraint, or the methods of if there is no class constraint.

  For generic methods, do not include the type arguments in . For example, the C# code GetMember("MyMethod<int>") searches for a member with the text name "MyMethod<int>", rather than for a method named MyMethod that has one generic argument of type int.

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

  An object representing the method that matches the specified requirements, if found; otherwise, null.

  The string containing the name of the method to get. A bitmask comprised of one or more that specify how the search is conducted. An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. The object that specifies the set of rules to use regarding the order and layout of arguments, how the return value is passed, what registers are used for arguments, and how the stack is cleaned up. An array of objects representing the number, order, and type of the parameters for the method to get. An array of objects representing the attributes associated with the corresponding element in the array. To be only used when calling through COM interop, and only parameters that are passed by reference are handled. The default binder does not process this parameter.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MethodInfo `` `` `` `` `` ``

  Although the default binder does not process (the parameter), you can use the abstract class to write a custom binder that does process . ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

  If is null, arguments are not matched.

  The following filter flags can be used to define which methods to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public methods in the search.

  Specify BindingFlags.NonPublic to include non-public methods (that is, private, internal, and protected methods) in the search.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the methods declared on the , not methods that were simply inherited.

  See for more information.

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

  An object representing the method that matches the specified requirements, if found; otherwise, null.

  The string containing the name of the method to get. A bitmask comprised of one or more that specify how the search is conducted. An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. The object that specifies the set of rules to use regarding the order and layout of arguments, how the return value is passed, what registers are used for arguments, and what process cleans up the stack. An array of objects representing the number, order, and type of the parameters for the method to get. An array of objects representing the attributes associated with the corresponding element in the array. The default binder does not process this parameter.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MethodInfo[]

  The method does not return methods in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which methods are returned, because that order varies.

  Constructors are not included in the array of methods returned by this call. Make a separate call to GetConstructors() to get the constructor methods.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

  If the current T:System.Type represents a constructed generic type, this method returns the objects with the type parameters replaced by the appropriate type arguments.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the methods of the class constraint, or the methods of if there is no class constraint.

  Returns all the public methods of the current .

  An array of objects representing all the public methods defined for the current .

  -or-

  An empty array of type , if no public methods are defined for the current .

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MethodInfo[] `` Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  The method does not return methods in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which methods are returned, because that order varies.

  The following filter flags can be used to define which methods to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public methods in the search.

  Specify BindingFlags.NonPublic to include non-public methods (that is, private, internal, and protected methods) in the search. Only protected and internal methods on base classes are returned; private methods on base classes are not returned.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.DeclaredOnly to search only the methods declared on the , not methods that were simply inherited.

  See for more information.

  You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

  If the current T:System.Type represents a constructed generic type, this method returns the objects with the type parameters replaced by the appropriate type arguments.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the methods of the class constraint, or the methods of if there is no class constraint.

  When overridden in a derived class, searches for the methods defined for the current , using the specified binding constraints.

  An array of objects representing all methods defined for the current that match the specified binding constraints.

  -or-

  An empty array of type , if no methods are defined for the current , or if none of the defined methods match the binding constraints.

  A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` is .

  The search for is case-sensitive.

  Use the simple name of the nested class for . Do not qualify it with the name of the outer class. For a generic nested class, use the mangled name — that is, append a grave accent and the number of generic arguments. For example, use the string "Inner`1" to get the generic nested class Inner<T> (Inner(Of T) in Visual Basic). Do not include language-specific syntax for type parameters.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the nested types of the class constraint.

  If a nested type is generic, this method returns its generic type definition. This is true even if the enclosing generic type is a closed constructed type.

  If the current represents a generic type defined in C#, Visual Basic, or C++, its nested types are all generic even if they have no generic parameters of their own. This is not necessarily true of nested types defined in dynamic assemblies or compiled with the MSIL Assembler (Ilasm.exe).

  For information on nested generic types, and on constructing nested generic types from their generic type definitions, see .

  Searches for the public nested type with the specified name.

  An object representing the public nested type with the specified name, if found; otherwise, null.

  The string containing the name of the nested type to get. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` `` is . Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  Use the simple name of the nested class for . Do not qualify it with the name of the outer class. For a generic nested class, use the mangled name — that is, append a grave accent and the number of generic parameters. For example, use the string "Inner`1" to get the generic nested class Inner<T> (Inner(Of T) in Visual Basic). Do not include language-specific syntax for type parameters.

  The following filter flags can be used to define which nested types to include in the search:

  You must specify either BindingFlags.Public or BindingFlags.NonPublic to get a return.

  Specify BindingFlags.Public to include public nested types in the search.

  Specify BindingFlags.NonPublic to include non-public nested types (that is, private, internal, and protected nested types) in the search.

  This method returns only the nested types of the current type. It does not search the base classes of the current type. To find types that are nested in base classes, you must walk the inheritance hierarchy, calling at each level.

  BindingFlags.Instance and BindingFlags.Static are ignored.

  Calling this method with only the flag or only the flag will return the specified nested types and does not require any other flags.

  See for more information.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the nested types of the class constraint.

  If a nested type is generic, this method returns its generic type definition. This is true even if the enclosing generic type is a closed constructed type.

  If the current represents a generic type defined in C#, Visual Basic, or C++, its nested types are all generic even if they have no generic parameters of their own. This is not necessarily true of nested types defined in dynamic assemblies or compiled with the MSIL Assembler (Ilasm.exe).

  For information on nested generic types, and on constructing nested generic types from their generic type definitions, see .

  When overridden in a derived class, searches for the specified nested type, using the specified binding constraints.

  An object representing the nested type that matches the specified requirements, if found; otherwise, null.

  The string containing the name of the nested type to get. A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type[]

  The method does not return types in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which types are returned, because that order varies.

  Only the public types immediately nested in the current type are returned; the search is not recursive.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the nested types of the class constraint.

  If a nested type is generic, this method returns its generic type definition. This is true even if the enclosing generic type is a closed constructed type.

  If the current represents a generic type defined in C#, Visual Basic, or C++, its nested types are all generic even if they have no generic parameters of their own. This is not necessarily true of nested types defined in dynamic assemblies or compiled with the MSIL Assembler (Ilasm.exe).

  For information on nested generic types, and on constructing nested generic types from their generic type definitions, see .

  Returns the public types nested in the current .

  An array of objects representing the public types nested in the current (the search is not recursive), or an empty array of type if no public types are nested in the current .

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type[] `` Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  The search for nested types is not recursive.

  The method does not return types in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which types are returned, because that order varies.

  The following filter flags can be used to define which nested types to include in the search:

  You must specify either BindingFlags.Public or BindingFlags.NonPublic to get a return.

  Specify BindingFlags.Public to include public nested types in the search.

  Specify BindingFlags.NonPublic to include non-public nested types (that is, private, internal, and protected nested types) in the search.

  This method returns only the nested types of the current type. It does not search the base classes of the current type. To find types that are nested in base classes, you must walk the inheritance hierarchy, calling at each level.

  BindingFlags.Instance and BindingFlags.Static are ignored.

  Calling this method with only the flag or only the flag will return the specified nested types and does not require any other flags.

  See for more information.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the nested types of the class constraint.

  If a nested type is generic, this method returns its generic type definition. This is true even if the enclosing generic type is a closed constructed type.

  If the current represents a generic type defined in C#, Visual Basic, or C++, its nested types are all generic even if they have no generic parameters of their own. This is not necessarily true of nested types defined in dynamic assemblies or compiled with the MSIL Assembler (Ilasm.exe).

  For information on nested generic types, and on constructing nested generic types from their generic type definitions, see .

  When overridden in a derived class, searches for the types nested in the current , using the specified binding constraints.

  An array of objects representing all the types nested in the current that match the specified binding constraints (the search is not recursive), or an empty array of type , if no nested types are found that match the binding constraints.

  A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.PropertyInfo[]

  A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

  The method does not return properties in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which properties are returned, because that order varies.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  If the current T:System.Type represents a constructed generic type, this method returns the objects with the type parameters replaced by the appropriate type arguments.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.

  Returns all the public properties of the current .

  An array of objects representing all public properties of the current .

  -or-

  An empty array of type , if the current does not have public properties.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.PropertyInfo[] `` Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

  The method does not return properties in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which properties are returned, because that order varies.

  The following filter flags can be used to define which nested types to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public properties in the search.

  Specify BindingFlags.NonPublic to include non-public properties (that is, private, internal, and protected properties) in the search. Only protected and internal properties on base classes are returned; private properties on base classes are not returned.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.DeclaredOnly to search only the properties declared on the , not properties that were simply inherited.

  See for more information.

  A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

  If the current T:System.Type represents a constructed generic type, this method returns the objects with the type parameters replaced by the appropriate type arguments.

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.

  When overridden in a derived class, searches for the properties of the current , using the specified binding constraints.

  An array of objects representing all properties of the current that match the specified binding constraints.

  -or-

  An empty array of type , if the current does not have properties, or if none of the properties match the binding constraints.

  A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.PropertyInfo `` More than one property matching the specified criteria was found.

  is .

  The search for is case-sensitive. The search includes public static and public instance properties.

  A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.

  Situations in which occurs include the following:

  A type contains two indexed properties that have the same name but different numbers of parameters. To resolve the ambiguity, use an overload of the method that specifies parameter types.

  A derived type declares a property that hides an inherited property with the same name, by using the new modifier (Shadows in Visual Basic). To resolve the ambiguity, use the method overload and include to restrict the search to members that are not inherited.

  ## Indexers and Default Properties

  vbprvblong, csprcslong, and vcprvclong have simplified syntax for accessing indexed properties and allow one indexed property to be a default for its type. For example, if the variable myList refers to an , the syntax myList[3] (myList(3) in Visual Basic) retrieves the element with the index of 3. You can overload the property.

  In C#, this feature is called an indexer and cannot be refered to by name. By default, a C# indexer appears in metadata as an indexed property named "Item". However, a class library developer can use the attribute to change the name of the indexer in the metadata. For example, the class has an indexer named . Indexed properties created using languages other than C# can have names other than Item, as well.

  To determine whether a type has a default property, use the method to test for the attribute. If the type has , the property returns the name of the default property.

  Searches for the public property with the specified name.

  An object representing the public property with the specified name, if found; otherwise, null.

  The string containing the name of the public property to get. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.PropertyInfo `` `` More than one property matching the specified criteria was found.

  is .

  Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

  The following filter flags can be used to define which properties to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public properties in the search.

  Specify BindingFlags.NonPublic to include non-public properties (that is, private, internal, and protected properties) in the search.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the properties declared on the , not properties that were simply inherited.

  See for more information.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.

  Situations in which occurs include the following:

  A type contains two indexed properties that have the same name but different numbers of parameters. To resolve the ambiguity, use an overload of the method that specifies parameter types.

  A derived type declares a property that hides an inherited property with the same name, using the new modifier (Shadows in Visual Basic). To resolve the ambiguity, include to restrict the search to members that are not inherited.

  ## Indexers and Default Properties

  vbprvblong, csprcslong, and vcprvclong have simplified syntax for accessing indexed properties and allow one indexed property to be a default for its type. For example, if the variable myList refers to an , the syntax myList[3] (myList(3) in Visual Basic) retrieves the element with the index of 3. You can overload the property.

  In C#, this feature is called an indexer and cannot be refered to by name. By default, a C# indexer appears in metadata as an indexed property named "Item". However, a class library developer can use the attribute to change the name of the indexer in the metadata. For example, the class has an indexer named . Indexed properties created using languages other than C# can have names other than Item, as well.

  To determine whether a type has a default property, use the method to test for the attribute. If the type has , the property returns the name of the default property.

  Searches for the specified property, using the specified binding constraints.

  An object representing the property that matches the specified requirements, if found; otherwise, null.

  The string containing the name of the property to get. A bitmask comprised of one or more that specify how the search is conducted. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.PropertyInfo `` `` More than one property matching the specified criteria was found.

  is .

  The return type of the property.

  A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

  The search for is case-sensitive. The search includes public static and public instance properties.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.

  ## Indexers and Default Properties

  vbprvblong, csprcslong, and vcprvclong have simplified syntax for accessing indexed properties and allow one indexed property to be a default for its type. For example, if the variable myList refers to an , the syntax myList[3] (myList(3) in Visual Basic) retrieves the element with the index of 3. You can overload the property.

  In C#, this feature is called an indexer and cannot be refered to by name. By default, a C# indexer appears in metadata as an indexed property named "Item". However, a class library developer can use the attribute to change the name of the indexer in the metadata. For example, the class has an indexer named . Indexed properties created using languages other than C# can have names other than Item, as well.

  To determine whether a type has a default property, use the method to test for the attribute. If the type has , the property returns the name of the default property.

  Searches for the public property with the specified name and return type.

  An object representing the public property with the specified name, if found; otherwise, null.

  The string containing the name of the public property to get. The return type of the property. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.PropertyInfo `` `` More than one property matching the specified criteria was found.

  or is , or at least one of the elements in is .

  has more than one dimension.

  A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

  The search for is case-sensitive. The search includes public static and public instance properties.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.

  ## Indexers and Default Properties

  vbprvblong, csprcslong, and vcprvclong have simplified syntax for accessing indexed properties and allow one indexed property to be a default for its type. For example, if the variable myList refers to an , the syntax myList[3] (myList(3) in Visual Basic) retrieves the element with the index of 3. You can overload the property.

  In C#, this feature is called an indexer and cannot be refered to by name. By default, a C# indexer appears in metadata as an indexed property named "Item". However, a class library developer can use the attribute to change the name of the indexer in the metadata. For example, the class has an indexer named . Indexed properties created using languages other than C# can have names other than Item, as well.

  To determine whether a type has a default property, use the method to test for the attribute. If the type has , the property returns the name of the default property.

  Searches for the specified public property whose parameters match the specified argument types.

  An object representing the public property whose parameters match the specified argument types, if found; otherwise, null.

  The string containing the name of the public property to get. An array of objects representing the number, order, and type of the parameters for the indexed property to get. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.PropertyInfo `` `` `` More than one property matching the specified criteria was found.

  or is , or at least one of the elements in is .

  has more than one dimension. The return type of the property.

  A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

  The search for is case-sensitive. The search includes public static and public instance properties.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.

  ## Indexers and Default Properties

  vbprvblong, csprcslong, and vcprvclong have simplified syntax for accessing indexed properties and allow one indexed property to be a default for its type. For example, if the variable myList refers to an , the syntax myList[3] (myList(3) in Visual Basic) retrieves the element with the index of 3. You can overload the property.

  In C#, this feature is called an indexer and cannot be refered to by name. By default, a C# indexer appears in metadata as an indexed property named "Item". However, a class library developer can use the attribute to change the name of the indexer in the metadata. For example, the class has an indexer named . Indexed properties created using languages other than C# can have names other than Item, as well.

  To determine whether a type has a default property, use the method to test for the attribute. If the type has , the property returns the name of the default property.

  Searches for the specified public property whose parameters match the specified argument types.

  An object representing the public property whose parameters match the specified argument types, if found; otherwise, null.

  The string containing the name of the public property to get. The return type of the property. An array of objects representing the number, order, and type of the parameters for the indexed property to get. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.PropertyInfo `` `` `` ``

  A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

  Although the default binder does not process (the parameter), you can use the abstract class to write a custom binder that does process . ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

  The search for is case-sensitive. The search includes public static and public instance properties.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.

  ## Indexers and Default Properties

  vbprvblong, csprcslong, and vcprvclong have simplified syntax for accessing indexed properties and allow one indexed property to be a default for its type. For example, if the variable myList refers to an , the syntax myList[3] (myList(3) in Visual Basic) retrieves the element with the index of 3. You can overload the property.

  In C#, this feature is called an indexer and cannot be refered to by name. By default, a C# indexer appears in metadata as an indexed property named "Item". However, a class library developer can use the attribute to change the name of the indexer in the metadata. For example, the class has an indexer named . Indexed properties created using languages other than C# can have names other than Item, as well.

  To determine whether a type has a default property, use the method to test for the attribute. If the type has , the property returns the name of the default property.

  Searches for the specified public property whose parameters match the specified argument types and modifiers.

  An object representing the public property that matches the specified requirements, if found; otherwise, null.

  The string containing the name of the public property to get. The return type of the property. An array of objects representing the number, order, and type of the parameters for the indexed property to get. An array of objects representing the attributes associated with the corresponding element in the array. The default binder does not process this parameter.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.PropertyInfo `` `` `` `` `` `` More than one property matching the specified criteria was found.

  or is , or at least one of the elements in is .

  has more than one dimension.

  Requires permission to retrieve information on non-public members of types in loaded assemblies. See . The return type of the property.

  A property is considered public to reflection if it has at least one accessor that is public. Otherwise the property is considered private, and you must use | | (in Visual Basic, combine the values using Or) to get it.

  Although the default binder does not process (the parameter), you can use the abstract class to write a custom binder that does process . ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  The following filter flags can be used to define which properties to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public properties in the search.

  Specify BindingFlags.NonPublic to include non-public properties (that is, private, internal, and protected properties) in the search.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the properties declared on the , not properties that were simply inherited.

  See for more information.

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

  If the current represents a type parameter in the definition of a generic type or generic method, this method searches the properties of the class constraint.

  ## Indexers and Default Properties

  vbprvblong, csprcslong, and vcprvclong have simplified syntax for accessing indexed properties and allow one indexed property to be a default for its type. For example, if the variable myList refers to an , the syntax myList[3] (myList(3) in Visual Basic) retrieves the element with the index of 3. You can overload the property.

  In C#, this feature is called an indexer and cannot be refered to by name. By default, a C# indexer appears in metadata as an indexed property named "Item". However, a class library developer can use the attribute to change the name of the indexer in the metadata. For example, the class has an indexer named . Indexed properties created using languages other than C# can have names other than Item, as well.

  To determine whether a type has a default property, use the method to test for the attribute. If the type has , the property returns the name of the default property.

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

  An object representing the property that matches the specified requirements, if found; otherwise, null.

  The string containing the name of the property to get. A bitmask comprised of one or more that specify how the search is conducted. An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. The return type of the property. An array of objects representing the number, order, and type of the parameters for the indexed property to get. An array of objects representing the attributes associated with the corresponding element in the array. The default binder does not process this parameter. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.PropertyInfo `` `` `` `` `` `` More than one property matching the specified criteria was found.

  or is , or at least one of the elements in is .

  has more than one dimension.

  Requires permission to retrieve information on non-public members of types in loaded assemblies. See . The return type of the property.

  Although the default binder does not process (the parameter), you can use the abstract class to write a custom binder that does process . ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

  The following filter flags can be used to define which properties to include in the search:

  You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.

  Specify BindingFlags.Public to include public properties in the search.

  Specify BindingFlags.NonPublic to include non-public properties (that is, private, internal, and protected properties) in the search.

  Specify BindingFlags.FlattenHierarchy to include public and protected static members up the hierarchy; private static members in inherited classes are not included.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the properties declared on the , not properties that were simply inherited.

  See for more information.

  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.

  An object representing the property that matches the specified requirements, if found; otherwise, null.

  The string containing the name of the property to get. A bitmask comprised of one or more that specify how the search is conducted. An object that defines a set of properties and enables binding, which can involve selection of an overloaded member, coercion of argument types, and invocation of a member through reflection. The return type of the property. An array of objects representing the number, order, and type of the parameters for the indexed property to get. An array of objects representing the attributes associated with the corresponding element in the array. The default binder does not process this parameter. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type To be added.

  Gets the current .

  The current .

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` is . A type initializer was invoked and threw an exception. Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  You can use the method to obtain a object for a type in another assembly, if the you know its namespace-qualified name. causes loading of the assembly specified in . You can also load an assembly using the method, and then use the or methods of the class to get objects. If a type is in an assembly known to your program at compile time, it is more efficient to use typeof in C#, in Visual Basic, or typeid in C++.

  GetType only works on assemblies loaded from disk. If you call GetType to look up a type defined in a dynamic assembly defined using the services, you might get inconsistent behavior. The behavior depends on whether the dynamic assembly is persistent, that is, created using the RunAndSave or Save access modes of the enumeration. If the dynamic assembly is persistent and has been written to disk before GetType is called, the loader finds the saved assembly on disk, loads that assembly, and retrieves the type from that assembly. If the assembly has not been saved to disk when GetType is called, the method returns null. GetType does not understand transient dynamic assemblies; therefore, calling GetType to retrieve a type in a transient dynamic assembly returns null.

  To use GetType on a dynamic module, subscribe to the event and call GetType before saving. Otherwise, you will get two copies of the assembly in memory.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  Arrays or COM types are not searched for unless they have already been loaded into the table of available classes.

  can be the type name qualified by its namespace or an assembly-qualified name that includes an assembly name specification. See .

  If includes the namespace but not the assembly name, this method searches only the calling object's assembly and Mscorlib.dll, in that order. If typeName is fully qualified with the partial or complete assembly name, this method searches in the specified assembly. If the assembly has a strong name, a complete assembly name is required.

  The property returns a fully qualified type name including nested types, the assembly name, and generic type arguments. All compilers that support the common language runtime will emit the simple name of a nested class, and reflection constructs a mangled name when queried, in accordance with the following conventions.

  In the .NET Framework version 2.0, processor architecture is added to assembly identity, and can be specified as part of assembly name strings. For example, "ProcessorArchitecture=msil". However, it is not included in the string returned by the property, for compatibility reasons. You can also load types by creating an object and passing it to an appropriate overload of the method. You can then use the method to load types from the assembly. See also .

  Delimiter

  Meaning

  Backslash (\)

  Escape character.

  Backtick (`)

  Precedes one or more digits representing the number of type parameters, located at the end of the name of a generic type.

  Brackets ([])

  Enclose a generic type argument list, for a constructed generic type; within a type argument list, enclose an assembly-qualified type.

  Comma (,)

  Precedes the Assembly name.

  Period (.)

  Denotes namespace identifiers.

  Plus sign (+)

  Precedes a nested class.

  For example, the fully qualified name for a class might look like this:

  `TopNamespace.SubNameSpace.ContainingClass+NestedClass,MyAssembly`

  If the namespace were TopNamespace.Sub+Namespace, then the string would have to precede the plus sign (+) with an escape character (\) to prevent it from being interpreted as a nesting separator. Reflection emits this string as follows:

  `TopNamespace.Sub\+Namespace.ContainingClass+NestedClass,MyAssembly`

  A "++" becomes "\+\+", and a "\" becomes "\\".

  This qualified name can be persisted and later used to load the . To search for and load a , use either with the type name only or with the assembly qualified type name. with the type name only will look for the in the caller's assembly and then in the System assembly. with the assembly qualified type name will look for the in any assembly.

  Type names may include trailing characters that denote additional information about the type, such as whether the type is a reference type, a pointer type or an array type. To retrieve the type name without these trailing characters, use t.GetElementType().ToString(), where is the type.

  Spaces are relevant in all type name components except the assembly name. In the assembly name, spaces before the ',' separator are relevant, but spaces after the ',' separator are ignored.

  The name of a generic type ends with a backtick (`) followed by digits representing the number of generic type arguments. The purpose of this name mangling is to allow compilers to support generic types with the same name but with different numbers of type parameters, occurring in the same scope. For example, reflection returns the mangled names Tuple`1 and Tuple`2 from the generic methods Tuple(Of T) and Tuple(Of T0, T1) in Visual Basic, or Tuple<T> and Tuple<T0, T1> in Visual C#.

  For generic types, the type argument list is enclosed in brackets, and the type arguments are separated by commas. For example, a generic has two type parameters. A of MyType with keys of type might be represented as follows:

  `System.Collections.Generic.Dictionary`2[System.String,MyType]`

  To specify an assembly-qualified type within a type argument list, enclose the assembly-qualified type within brackets. Otherwise, the commas that separate the parts of the assembly-qualified name are interpreted as delimiting additional type arguments. For example, a of MyType from MyAssembly.dll, with keys of type , might be specified as follows:

  `Type.GetType("System.Collections.Generic.Dictionary`2[System.String,[MyType,MyAssembly]]")`

  An assembly-qualified type can be enclosed in brackets only when it appears within a type parameter list. The rules for searching assemblies for qualified and unqualified types in type parameter lists are the same as the rules for qualified and unqualified nongeneric types.

  Nullable types are a special case of generic types. For example, a nullable is represented by the string "System.Nullable`1[System.Int32]".

  In C#, C++, and Visual Basic you can also get nullable types using type operators. For example, the nullable type is returned by typeof(Nullable<bool>) in C#, by Nullable<Boolean>::typeid in C++, and by GetType(Nullable(Of Boolean)) in Visual Basic.

  The following table shows the syntax you use with GetType for various types.

  To Get

  Use

  A nullable

  Type.GetType("System.Nullable`1[System.Int32]")

  An unmanaged pointer to MyType

  Type.GetType("MyType*")

  An unmanaged pointer to a pointer to MyType

  Type.GetType("MyType**")

  A managed pointer or reference to MyType

  Type.GetType("MyType&"). Note that unlike pointers, references are limited to one level.

  A parent class and a nested class

  Type.GetType("MyParentClass+MyNestedClass")

  A one-dimensional array with a lower bound of 0

  Type.GetType("MyType[]")

  A one-dimensional array with an unknown lower bound

  Type.GetType("MyType[*]")

  An n-dimensional array

  A comma (,) inside the brackets a total of n-1 times. For example, System.Object[,,] represents a three-dimensional Object array.

  An array of one-dimensional arrays

  Type.GetType("MyType[][]")

  A rectangular two-dimensional array with unknown lower bounds

  Type.GetType("MyType[,]")

  A generic type with one type argument

  Type.GetType("MyGenericType`1[MyType]")

  A generic type with two type arguments

  Type.GetType("MyGenericType`2[MyType,AnotherType]")

  A generic type with two assembly-qualified type arguments

  Type.GetType("MyGenericType`2[[MyType,MyAssembly],[AnotherType,AnotherAssembly]]")

  An assembly-qualified generic type with an assembly-qualified type argument

  Type.GetType("MyGenericType`1[[MyType,MyAssembly]],MyGenericTypeAssembly")

  A generic type whose type argument is a generic type with two type arguments

  Type.GetType("MyGenericType`1[AnotherGenericType`2[MyType,AnotherType]]")

  Gets the with the specified name, performing a case-sensitive search.

  The type with the specified name, if found; otherwise, null.

  The assembly-qualified name of the type to get. See . If the type is in the currently executing assembly or in Mscorlib.dll, it is sufficient to supply the type name qualified by its namespace. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` `` is . A type initializer was invoked and threw an exception. is and an error was encountered while loading the . Requires permission to retrieve information on non-public objects. See

  You can use the method to obtain a object for a type in another assembly, if the you know its namespace-qualified name. causes loading of the assembly specified in . You can also load an assembly using the method, and then use the or methods of the class to get objects. If a type is in an assembly known to your program at compile time, it is more efficient to use typeof in C#, in Visual Basic, or typeid in C++.

  GetType only works on assemblies loaded from disk. If you call GetType to look up a type defined in a dynamic assembly defined using the services, you might get inconsistent behavior. The behavior depends on whether the dynamic assembly is persistent, that is, created using the RunAndSave or Save access modes of the enumeration. If the dynamic assembly is persistent and has been written to disk before GetType is called, the loader finds the saved assembly on disk, loads that assembly, and retrieves the type from that assembly. If the assembly has not been saved to disk when GetType is called, the method returns null. GetType does not understand transient dynamic assemblies; therefore, calling GetType to retrieve a type in a transient dynamic assembly returns null.

  To use GetType on a dynamic module, subscribe to the event and call GetType before saving. Otherwise, you will get two copies of the assembly in memory.

  The parameter specifies what happens when the type is not found, and also suppresses certain other exception conditions, as described in the Exceptions section. Some exceptions are thrown regardless of the value of . For example, if the type is found but cannot be loaded, a is thrown even if is false.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  Arrays or COM types are not searched for unless they have already been loaded into the table of available classes.

  can be the type name qualified by its namespace or an assembly-qualified name that includes an assembly name specification. See .

  If includes the namespace but not the assembly name, this method searches only the calling object's assembly and Mscorlib.dll, in that order. If typeName is fully qualified with the partial or complete assembly name, this method searches in the specified assembly. If the assembly has a strong name, a complete assembly name is required.

  The property returns a fully qualified type name including nested types, the assembly name, and generic arguments. All compilers that support the common language runtime will emit the simple name of a nested class, and reflection constructs a mangled name when queried, in accordance with the following conventions.

  In the .NET Framework version 2.0, processor architecture is added to assembly identity, and can be specified as part of assembly name strings. For example, "ProcessorArchitecture=msil". However, it is not included in the string returned by the property, for compatibility reasons. You can also load types by creating an object and passing it to an appropriate overload of the method. You can then use the method to load types from the assembly. See also .

  Delimiter

  Meaning

  Backslash (\)

  Escape character.

  Backtick (`)

  Precedes one or more digits representing the number of type parameters, located at the end of the name of a generic type.

  Brackets ([])

  Enclose a generic type argument list, for a constructed generic type; within a type argument list, enclose an assembly-qualified type.

  Comma (,)

  Precedes the Assembly name.

  Period (.)

  Denotes namespace identifiers.

  Plus sign (+)

  Precedes a nested class.

  For example, the fully qualified name for a class might look like this:

  `TopNamespace.SubNameSpace.ContainingClass+NestedClass,MyAssembly`

  If the namespace were TopNamespace.Sub+Namespace, then the string would have to precede the plus sign (+) with an escape character (\) to prevent it from being interpreted as a nesting separator. Reflection emits this string as follows:

  `TopNamespace.Sub\+Namespace.ContainingClass+NestedClass,MyAssembly`

  A "++" becomes "\+\+", and a "\" becomes "\\".

  This qualified name can be persisted and later used to load the . To search for and load a , use either with the type name only or with the assembly qualified type name. with the type name only will look for the in the caller's assembly and then in the System assembly. with the assembly qualified type name will look for the in any assembly.

  Type names may include trailing characters that denote additional information about the type, such as whether the type is a reference type, a pointer type or an array type. To retrieve the type name without these trailing characters, use t.GetElementType().ToString(), where is the type.

  Spaces are relevant in all type name components except the assembly name. In the assembly name, spaces before the ',' separator are relevant, but spaces after the ',' separator are ignored.

  The name of a generic type ends with a backtick (`) followed by digits representing the number of generic type arguments. The purpose of this name mangling is to allow compilers to support generic types with the same name but with different numbers of type parameters, occurring in the same scope. For example, reflection returns the mangled names Tuple`1 and Tuple`2 from the generic methods Tuple(Of T) and Tuple(Of T0, T1) in Visual Basic, or Tuple<T> and Tuple<T0, T1> in Visual C#.

  For generic types, the type argument list is enclosed in brackets, and the type arguments are separated by commas. For example, a generic has two type parameters. A of MyType with keys of type might be represented as follows:

  `System.Collections.Generic.Dictionary`2[System.String,MyType]`

  To specify an assembly-qualified type within a type argument list, enclose the assembly-qualified type within brackets. Otherwise, the commas that separate the parts of the assembly-qualified name are interpreted as delimiting additional type arguments. For example, a of MyType from MyAssembly.dll, with keys of type , might be specified as follows:

  `Type.GetType("System.Collections.Generic.Dictionary`2[System.String,[MyType,MyAssembly]]")`

  An assembly-qualified type can be enclosed in brackets only when it appears within a type parameter list. The rules for searching assemblies for qualified and unqualified types in type parameter lists are the same as the rules for qualified and unqualified nongeneric types.

  Nullable types are a special case of generic types. For example, a nullable is represented by the string "System.Nullable`1[System.Int32]".

  In C#, C++, and Visual Basic you can also get nullable types using type operators. For example, the nullable type is returned by typeof(Nullable<bool>) in C#, by Nullable<Boolean>::typeid in C++, and by GetType(Nullable(Of Boolean)) in Visual Basic.

  The following table shows the syntax you use with GetType for various types.

  To Get

  Use

  A nullable

  Type.GetType("System.Nullable`1[System.Int32]")

  An unmanaged pointer to MyType

  Type.GetType("MyType*")

  An unmanaged pointer to a pointer to MyType

  Type.GetType("MyType**")

  A managed pointer or reference to MyType

  Type.GetType("MyType&"). Note that unlike pointers, references are limited to one level.

  A parent class and a nested class

  Type.GetType("MyParentClass+MyNestedClass")

  A one-dimensional array with a lower bound of 0

  Type.GetType("MyArray[]")

  A one-dimensional array with an unknown lower bound

  Type.GetType("MyArray[*]")

  An n-dimensional array

  A comma (,) inside the brackets a total of n-1 times. For example, System.Object[,,] represents a three-dimensional Object array.

  A two-dimensional array's array

  Type.GetType("MyArray[][]")

  A rectangular two-dimensional array with unknown lower bounds

  Type.GetType("MyArray[,]")

  A generic type with one type argument

  Type.GetType("MyGenericType`1[MyType]")

  A generic type with two type arguments

  Type.GetType("MyGenericType`2[MyType,AnotherType]")

  A generic type with two assembly-qualified type arguments

  Type.GetType("MyGenericType`2[[MyType,MyAssembly],[AnotherType,AnotherAssembly]]")

  An assembly-qualified generic type with an assembly-qualified type argument

  Type.GetType("MyGenericType`1[[MyType,MyAssembly]],MyGenericTypeAssembly")

  A generic type whose type argument is a generic type with two type arguments

  Type.GetType("MyGenericType`1[AnotherGenericType`2[MyType,AnotherType]]")

  Gets the with the specified name, performing a case-sensitive search and specifying whether to throw an exception if the type is not found.

  The type with the specified name. If the type is not found, the parameter specifies whether null is returned or an exception is thrown. In some cases, an exception is thrown regardless of the value of . See the Exceptions section.

  The assembly-qualified name of the type to get. See . If the type is in the currently executing assembly or in Mscorlib.dll, it is sufficient to supply the type name qualified by its namespace. true to throw an exception if the type cannot be found; false to return null. Specifying false also suppresses some other exception conditions, but not all of them. See the Exceptions section. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` `` `` is . A type initializer was invoked and threw an exception. is and an error was encountered while loading the selected . Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  You can use the method to obtain a object for a type in another assembly, if the you know its namespace-qualified name. causes loading of the assembly specified in . You can also load an assembly using the method, and then use the or methods of the class to get objects. If a type is in an assembly known to your program at compile time, it is more efficient to use typeof in C#, in Visual Basic, or typeid in C++.

  GetType only works on assemblies loaded from disk. If you call GetType to look up a type defined in a dynamic assembly defined using the services, you might get inconsistent behavior. The behavior depends on whether the dynamic assembly is persistent, that is, created using the RunAndSave or Save access modes of the enumeration. If the dynamic assembly is persistent and has been written to disk before GetType is called, the loader finds the saved assembly on disk, loads that assembly, and retrieves the type from that assembly. If the assembly has not been saved to disk when GetType is called, the method returns null. GetType does not understand transient dynamic assemblies; therefore, calling GetType to retrieve a type in a transient dynamic assembly returns null.

  To use GetType on a dynamic module, subscribe to the event and call GetType before saving. Otherwise, you will get two copies of the assembly in memory.

  The parameter specifies what happens when the type is not found, and also suppresses certain other exception conditions, as described in the Exceptions section. Some exceptions are thrown regardless of the value of . For example, if the type is found but cannot be loaded, a is thrown even if is false.

  The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

  Member Type

  Static

  Non-Static

  Constructor

  No

  No

  Field

  No

  Yes. A field is always hide-by-name-and-signature.

  Event

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Method

  No

  Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

  Nested Type

  No

  No

  Property

  Not applicable

  The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

  Hide-by-name-and-signature considers all of the parts of the signature, including custom modifiers, return types, parameter types, sentinels, and unmanaged calling conventions. This is a binary comparison.

  For reflection, properties and events are hide-by-name-and-signature. If you have a property with both a get and a set accessor in the base class, but the derived class has only a get accessor, the derived class property hides the base class property, and you will not be able to access the setter on the base class.

  Custom attributes are not part of the common type system.

  Arrays or COM types are not searched for unless they have already been loaded into the table of available classes.

  can be the type name qualified by its namespace or an assembly-qualified name that includes an assembly name specification. See .

  If includes the namespace but not the assembly name, this method searches only the calling object's assembly and Mscorlib.dll, in that order. If typeName is fully qualified with the partial or complete assembly name, this method searches in the specified assembly. If the assembly has a strong name, a complete assembly name is required.

  The property returns a fully qualified type name including nested types, the assembly name, and type arguments. All compilers that support the common language runtime will emit the simple name of a nested class, and reflection constructs a mangled name when queried, in accordance with the following conventions.

  In the .NET Framework version 2.0, processor architecture is added to assembly identity, and can be specified as part of assembly name strings. For example, "ProcessorArchitecture=msil". However, it is not included in the string returned by the property, for compatibility reasons. You can also load types by creating an object and passing it to an appropriate overload of the method. You can then use the method to load types from the assembly. See also .

  Delimiter

  Meaning

  Backslash (\)

  Escape character.

  Backtick (`)

  Precedes one or more digits representing the number of type parameters, located at the end of the name of a generic type.

  Brackets ([])

  Enclose a generic type argument list, for a constructed generic type; within a type argument list, enclose an assembly-qualified type.

  Comma (,)

  Precedes the Assembly name.

  Period (.)

  Denotes namespace identifiers.

  Plus sign (+)

  Precedes a nested class.

  For example, the fully qualified name for a class might look like this:

  `TopNamespace.SubNameSpace.ContainingClass+NestedClass,MyAssembly`

  If the namespace were TopNamespace.Sub+Namespace, then the string would have to precede the plus sign (+) with an escape character (\) to prevent it from being interpreted as a nesting separator. Reflection emits this string as follows:

  `TopNamespace.Sub\+Namespace.ContainingClass+NestedClass,MyAssembly`

  A "++" becomes "\+\+", and a "\" becomes "\\".

  This qualified name can be persisted and later used to load the . To search for and load a , use either with the type name only or with the assembly qualified type name. with the type name only will look for the in the caller's assembly and then in the System assembly. with the assembly qualified type name will look for the in any assembly.

  Type names may include trailing characters that denote additional information about the type, such as whether the type is a reference type, a pointer type or an array type. To retrieve the type name without these trailing characters, use t.GetElementType().ToString(), where is the type.

  Spaces are relevant in all type name components except the assembly name. In the assembly name, spaces before the ',' separator are relevant, but spaces after the ',' separator are ignored.

  The name of a generic type ends with a backtick (`) followed by digits representing the number of generic type arguments. The purpose of this name mangling is to allow compilers to support generic types with the same name but with different numbers of type parameters, occurring in the same scope. For example, reflection returns the mangled names Tuple`1 and Tuple`2 from the generic methods Tuple(Of T) and Tuple(Of T0, T1) in Visual Basic, or Tuple<T> and Tuple<T0, T1> in Visual C#.

  For generic types, the type argument list is enclosed in brackets, and the type arguments are separated by commas. For example, a generic has two type parameters. A of MyType with keys of type might be represented as follows:

  `System.Collections.Generic.Dictionary`2[System.String,MyType]`

  To specify an assembly-qualified type within a type argument list, enclose the assembly-qualified type within brackets. Otherwise, the commas that separate the parts of the assembly-qualified name are interpreted as delimiting additional type arguments. For example, a of MyType from MyAssembly.dll, with keys of type , might be specified as follows:

  `Type.GetType("System.Collections.Generic.Dictionary`2[System.String,[MyType,MyAssembly]]")`

  An assembly-qualified type can be enclosed in brackets only when it appears within a type parameter list. The rules for searching assemblies for qualified and unqualified types in type parameter lists are the same as the rules for qualified and unqualified nongeneric types.

  Nullable types are a special case of generic types. For example, a nullable is represented by the string "System.Nullable`1[System.Int32]".

  In C#, C++, and Visual Basic you can also get nullable types using type operators. For example, the nullable type is returned by typeof(Nullable<bool>) in C#, by Nullable<Boolean>::typeid in C++, and by GetType(Nullable(Of Boolean)) in Visual Basic.

  The following table shows the syntax you use with GetType for various types.

  To Get

  Use

  A nullable

  Type.GetType("System.Nullable`1[System.Int32]")

  An unmanaged pointer to MyType

  Type.GetType("MyType*")

  An unmanaged pointer to a pointer to MyType

  Type.GetType("MyType**")

  A managed pointer or reference to MyType

  Type.GetType("MyType&"). Note that unlike pointers, references are limited to one level.

  A parent class and a nested class

  Type.GetType("MyParentClass+MyNestedClass")

  A one-dimensional array with a lower bound of 0

  Type.GetType("MyArray[]")

  A one-dimensional array with an unknown lower bound

  Type.GetType("MyArray[*]")

  An n-dimensional array

  A comma (,) inside the brackets a total of n-1 times. For example, System.Object[,,] represents a three-dimensional Object array.

  A two-dimensional array's array

  Type.GetType("MyArray[][]")

  A rectangular two-dimensional array with unknown lower bounds

  Type.GetType("MyArray[,]")

  A generic type with one type argument

  Type.GetType("MyGenericType`1[MyType]")

  A generic type with two type arguments

  Type.GetType("MyGenericType`2[MyType,AnotherType]")

  A generic type with two assembly-qualified type arguments

  Type.GetType("MyGenericType`2[[MyType,MyAssembly],[AnotherType,AnotherAssembly]]")

  An assembly-qualified generic type with an assembly-qualified type argument

  Type.GetType("MyGenericType`1[[MyType,MyAssembly]],MyGenericTypeAssembly")

  A generic type whose type argument is a generic type with two type arguments

  Type.GetType("MyGenericType`1[AnotherGenericType`2[MyType,AnotherType]]")

  Gets the with the specified name, specifying whether to perform a case-sensitive search and whether to throw an exception if the type is not found.

  The type with the specified name. If the type is not found, the parameter specifies whether null is returned or an exception is thrown. In some cases, an exception is thrown regardless of the value of . See the Exceptions section.

  The assembly-qualified name of the type to get. See . If the type is in the currently executing assembly or in Mscorlib.dll, it is sufficient to supply the type name qualified by its namespace. true to throw an exception if the type cannot be found; false to return null.Specifying false also suppresses some other exception conditions, but not all of them. See the Exceptions section. true to perform a case-insensitive search for , false to perform a case-sensitive search for . 1 Reflection
- Method
  4.0.0.0
  System.Type `` `` ``

  Usage scenarios for this method and details about the and parameters can be found in the method overload.

  Calling this method overload is the same as calling the method overload and specifying false for the and parameters.

  Gets the type with the specified name, optionally providing custom methods to resolve the assembly and the type.

  The type with the specified name, or null if the type is not found.

  The name of the type to get. If the parameter is provided, the type name can be any string that is capable of resolving. If the parameter is provided or if standard type resolution is used, must be an assembly-qualified name (see ), unless the type is in the currently executing assembly or in Mscorlib.dll, in which case it is sufficient to supply the type name qualified by its namespace. A method that locates and returns the assembly that is specified in . The assembly name is passed to as an object. If does not contain the name of an assembly, is not called. If is not supplied, standard assembly resolution is performed. A method that locates and returns the type that is specified by from the assembly that is returned by or by standard assembly resolution. If no assembly is provided, the method can provide one. The method also takes a parameter that specifies whether to perform a case-insensitive search; false is passed to that parameter.
- Method
  4.0.0.0
  System.Type `` `` `` ``

  Usage scenarios for this method and details about the and parameters can be found in the method overload.

  Calling this method overload is the same as calling the method overload and specifying false for the parameter.

  Gets the type with the specified name, specifying whether to throw an exception if the type is not found, and optionally providing custom methods to resolve the assembly and the type.

  The type with the specified name. If the type is not found, the parameter specifies whether null is returned or an exception is thrown. In some cases, an exception is thrown regardless of the value of . See the Exceptions section.

  The name of the type to get. If the parameter is provided, the type name can be any string that is capable of resolving. If the parameter is provided or if standard type resolution is used, must be an assembly-qualified name (see ), unless the type is in the currently executing assembly or in Mscorlib.dll, in which case it is sufficient to supply the type name qualified by its namespace. A method that locates and returns the assembly that is specified in . The assembly name is passed to as an object. If does not contain the name of an assembly, is not called. If is not supplied, standard assembly resolution is performed. A method that locates and returns the type that is specified by from the assembly that is returned by or by standard assembly resolution. If no assembly is provided, the method can provide one. The method also takes a parameter that specifies whether to perform a case-insensitive search; false is passed to that parameter. true to throw an exception if the type cannot be found; false to return null. Specifying false also suppresses some other exception conditions, but not all of them. See the Exceptions section.
- Method
  4.0.0.0
  System.Type `` `` `` `` ``

  Use this method overload and its associated overloads ( and ) to replace the default implementation of the method with more flexible implementations. By providing your own methods that resolve type names and the names of the assemblies that contain them, you can do the following:

  Control which version of an assembly a type is loaded from.

  Provide another place to look for a type name that does not include an assembly name.

  Load assemblies using partial assembly names.

  Return subclasses of that are not created by the common language runtime (CLR).

  For example, in version-tolerant serialization this method enables you to search for a "best fit" assembly by using a partial name. Other overloads of the method require an assembly-qualified type name, which includes the version number.

  Alternate implementations of the type system may need to return subclasses of that are not created by the CLR; all types that are returned by other overloads of the method are runtime types.

  ## Usage Notes

  This method overload and its associated overloads parse into the name of a type and the name of an assembly, and then resolve the names. Resolution of the assembly name occurs before resolution of the type name, because a type name must be resolved in the context of an assembly.

  If you are unfamiliar with the concept of assembly-qualified type names, see the property.

  If is not an assembly-qualified name, assembly resolution is skipped. Unqualified type names can be resolved in the context of Mscorlib.dll or the currently executing assembly, or you can optionally provide an assembly in the parameter. The effects of including or omitting the assembly name for different kinds of name resolution are displayed as a table in the Mixed Name Resolution section.

  General usage notes:

  Do not pass methods to or if they come from unknown or untrusted callers. Use only methods that you provide or that you are familiar with.

  Using methods from unknown or untrusted callers could result in elevation of privilege for malicious code.

  If you omit the and/or parameters, the value of the parameter is passed to the methods that perform the default resolution.

  If is true, this method throws a when returns null, and a when returns null.

  This method does not catch exceptions thrown by and . You are responsible for any exceptions that are thrown by the resolver methods.

  ## Resolving Assemblies

  The method receives an object, which is produced by parsing the string assembly name that is included in . If does not contain an assembly name, is not called and null is passed to .

  If is not supplied, standard assembly probing is used to locate the assembly. If is provided, the method does not do standard probing; in that case you must ensure that your can handle all the assemblies you pass to it.

  The method should return null if the assembly cannot be resolved. If returns null, is not called and no further processing occurs; additionally, if is true, a is thrown.

  If the that is passed to is a partial name, one or more of its parts are null. For example, if it has no version, the property is null. If the property, the property, and the method all return null, then only the simple name of the assembly was supplied. The method can use or ignore all parts of the assembly name.

  The effects of different assembly resolution options are displayed as a table in the Mixed Name Resolution section, for simple and assembly-qualified type names.

  ## Resolving Types

  If does not specify an assembly name, is always called. If specifies an assembly name, is called only when the assembly name is successfully resolved. If or standard assembly probing returns null, is not called.

  The method receives three arguments:

  The assembly to search or null if does not contain an assembly name.

  The simple name of the type. In the case of a nested type, this is the outermost containing type. In the case of a generic type, this is the simple name of the generic type.

  A Boolean value that is true if the case of type names is to be ignored.

  The implementation determines the way these arguments are used. The method should return null if it cannot resolve the type. If returns null and is true, this overload of throws a .

  The effects of different type resolution options are displayed as a table in the Mixed Name Resolution section, for simple and assembly-qualified type names.

  ## Resolving Nested Types

  If is a nested type, only the name of the outermost containing type is passed to . When returns this type, the method is called recursively until the innermost nested type has been resolved.

  ## Resolving Generic Types

  The is called recursively to resolve generic types: First to resolve the generic type itself, and then to resolve its type arguments. If a type argument is generic, is called recursively to resolve its type arguments, and so on.

  The combination of and that you provide must be capable of resolving all levels of this recursion. For example, suppose you supply an that controls the loading of MyAssembly. Suppose you want to resolve the generic type Dictionary<string, MyType> (Dictionary(Of String, MyType) in Visual Basic). You might pass the following generic type name:

  `"System.Collections.Generic.Dictionary`2[System.String,[MyNamespace.MyType, MyAssembly]]"`

  Notice that MyType is the only assembly-qualified type argument. The names of the and classes are not assembly-qualified. Your must be able handle either an assembly or null, because it will receive null for and . It can handle that case by calling an overload of the method that takes a string, because both of the unqualified type names are in Mscorlib.dll:

  code reference: GetTypeOnSteroids#1

  The method is not called for the dictionary type and the string type, because those type names are not assembly-qualified.

  Now suppose that instead of System.String, the first generic argument type is YourType, from YourAssembly:

  `"System.Collections.Generic.Dictionary`2[[YourNamespace.YourType, YourAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null], [MyNamespace.MyType, MyAssembly]]"`

  Because this assembly is neither Mscorlib.dll nor the currently executing assembly, you cannot resolve YourType without an assembly-qualified name. Because your will be called recursively, it must be able to handle this case. Instead of returning null for assemblies other than MyAssembly, it now performs an assembly load using the supplied object.

  code reference: GetTypeOnSteroids#2

  Back to Usage Notes.

  ## Resolving Type Names with Special Characters

  Certain characters have special meanings in assembly-qualified names. If a simple type name contains these characters, the characters cause parsing errors when the simple name is part of an assembly-qualified name. To avoid the parsing errors, you must escape the special characters with a backslash before you can pass the assembly-qualified name to the method. For example, if a type is named Strange]Type, the escape character must be added ahead of the square bracket as follows: Strange\]Type.

  Names with such special characters cannot be created in Visual Basic or C#, but can be created by using Microsoft intermediate language (MSIL) or by emitting dynamic assemblies.

  The following table shows the special characters for type names.

  Character

  Meaning

  , (comma)

  Delimiter for assembly-qualified names.

  [] (square brackets)

  As a suffix pair, indicates an array type; as a delimiter pair, encloses generic argument lists and assembly-qualified names.

  & (ampersand)

  As a suffix, indicates that a type is a reference type.

  * (asterisk)

  As a suffix, indicates that a type is a pointer type.

  + (plus)

  Delimiter for nested types.

  \ (backslash)

  Escape character.

  Properties such as return correctly escaped strings. You must pass correctly escaped strings to the method. In turn, the method passes correctly escaped names to and to the default type resolution methods. If you need to compare a name to an unescaped name in , you must remove the escape characters.

  Back to Usage Notes.

  ## Mixed Name Resolution

  The following table summarizes the interactions between , , and default name resolution, for all combinations of type name and assembly name in :

  Contents of type name

  Assembly resolver method

  Type resolver method

  Result

  type, assembly

  null

  null

  Equivalent to calling the method overload.

  type, assembly

  provided

  null

  returns the assembly or returns null if it cannot resolve the assembly. If the assembly is resolved, the method overload is used to load the type from the assembly; otherwise, there is no attempt to resolve the type.

  type, assembly

  null

  provided

  Equivalent to converting the assembly name to an object and calling the method overload to get the assembly. If the assembly is resolved, it is passed to ; otherwise, is not called and there is no further attempt to resolve the type.

  type, assembly

  provided

  provided

  returns the assembly or returns null if it cannot resolve the assembly. If the assembly is resolved, it is passed to ; otherwise, is not called and there is no further attempt to resolve the type.

  type

  null, provided

  null

  Equivalent to calling the method overload. Because the assembly name is not provided, only Mscorlib.dll and the currently executing assembly are searched. If is provided, it is ignored.

  type

  null, provided

  provided

  is called, and null is passed for the assembly. can provide a type from any assembly, including assemblies it loads for the purpose. If is provided, it is ignored.

  assembly

  null, provided

  null, provided

  A is thrown, because the assembly name is parsed as if it were an assembly-qualified type name. This results in an invalid assembly name.

  Back to: Usage Notes, Resolving Assemblies, Resolving Types.

  Gets the type with the specified name, specifying whether to perform a case-sensitive search and whether to throw an exception if the type is not found, and optionally providing custom methods to resolve the assembly and the type.

  The type with the specified name. If the type is not found, the parameter specifies whether null is returned or an exception is thrown. In some cases, an exception is thrown regardless of the value of . See the Exceptions section.

  The name of the type to get. If the parameter is provided, the type name can be any string that is capable of resolving. If the parameter is provided or if standard type resolution is used, must be an assembly-qualified name (see ), unless the type is in the currently executing assembly or in Mscorlib.dll, in which case it is sufficient to supply the type name qualified by its namespace. A method that locates and returns the assembly that is specified in . The assembly name is passed to as an object. If does not contain the name of an assembly, is not called. If is not supplied, standard assembly resolution is performed. A method that locates and returns the type that is specified by from the assembly that is returned by or by standard assembly resolution. If no assembly is provided, the method can provide one. The method also takes a parameter that specifies whether to perform a case-insensitive search; the value of is passed to that parameter. true to throw an exception if the type cannot be found; false to return null. Specifying false also suppresses some other exception conditions, but not all of them. See the Exceptions section. true to perform a case-insensitive search for , false to perform a case-sensitive search for .
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type[] `` To be added. is . The type initializers were invoked and at least one threw an exception. Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  Gets the types of the objects in the specified array.

  An array of objects representing the types of the corresponding elements in .

  An array of objects whose types to determine. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.TypeCode ``

  When you inherit from , you can change the behavior of this method by overriding the method.

  Gets the underlying type code of the specified .

  The code of the underlying type, or if is null.

  The type whose underlying type code to get.
- Method
  4.0.0.0
  System.TypeCode

  This method provides the implementation for the method. When you inherit from , you can override this method to provide your own implementation of .

  Returns the underlying type code of the specified .

  The code of the underlying type.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` To be added.

  Gets the type associated with the specified class identifier (CLSID).

  System.__ComObject regardless of whether the CLSID is valid.

  The CLSID of the type to get.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` ``

  Exceptions such as will be thrown when specifying true for , but it will not fail for unregistered CLSIDs.

  Gets the type associated with the specified class identifier (CLSID), specifying whether to throw an exception if an error occurs while loading the type.

  System.__ComObject regardless of whether the CLSID is valid.

  The CLSID of the type to get. true to throw any exception that occurs.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` `` To be added.

  Gets the type associated with the specified class identifier (CLSID) from the specified server.

  System.__ComObject regardless of whether the CLSID is valid.

  The CLSID of the type to get. The server from which to load the type. If the server name is null, this method automatically reverts to the local machine.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` `` ``

  Exceptions such as will be thrown when specifying true for , but it will not fail for unregistered CLSIDs.

  Gets the type associated with the specified class identifier (CLSID) from the specified server, specifying whether to throw an exception if an error occurs while loading the type.

  System.__ComObject regardless of whether the CLSID is valid.

  The CLSID of the type to get. The server from which to load the type. If the server name is null, this method automatically reverts to the local machine. true to throw any exception that occurs.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` is . The requested type is non-public and outside the current assembly, and the caller does not have the required permission. A type initializer was invoked and threw an exception. Requires permission to retrieve information on non-public objects. See

  The handles are valid only in the application domain in which they were obtained.

  Gets the type referenced by the specified type handle.

  The type referenced by the specified , or null if the property of is null.

  The object that refers to the type. 1 RuntimeInfrastructure
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type ``

  This method is provided for COM support. ProgIDs are not used in the Microsoft .NET Framework because they have been superseded by the concept of namespace.

  Gets the type associated with the specified program identifier (ProgID), returning null if an error is encountered while loading the .

  The type associated with the specified ProgID, if is a valid entry in the registry and a type is associated with it; otherwise, null.

  The ProgID of the type to get.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` ``

  This method is provided for COM support. Program IDs are not used in Microsoft .NET Framework because they have been superseded by the concept of namespace.

  Gets the type associated with the specified program identifier (ProgID), specifying whether to throw an exception if an error occurs while loading the type.

  The type associated with the specified program identifier (ProgID), if is a valid entry in the registry and a type is associated with it; otherwise, null.

  The ProgID of the type to get. true to throw any exception that occurs.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` ``

  This method is provided for COM support. Program IDs are not used in Microsoft .NET Framework because they have been superseded by the concept of namespace.

  Gets the type associated with the specified program identifier (progID) from the specified server, returning null if an error is encountered while loading the type.

  The type associated with the specified program identifier (progID), if is a valid entry in the registry and a type is associated with it; otherwise, null.

  The progID of the type to get. The server from which to load the type. If the server name is null, this method automatically reverts to the local machine.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type `` `` ``

  This method is provided for COM support. Program IDs are not used in Microsoft .NET Framework because they have been superseded by the concept of namespace.

  Gets the type associated with the specified program identifier (progID) from the specified server, specifying whether to throw an exception if an error occurs while loading the type.

  The type associated with the specified program identifier (progID), if is a valid entry in the registry and a type is associated with it; otherwise, null.

  The progID of the to get. The server from which to load the type. If the server name is null, this method automatically reverts to the local machine. true to throw any exception that occurs.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.RuntimeTypeHandle ``

  The handles are valid only in the application domain in which they were obtained.

  Gets the handle for the of a specified object.

  The handle for the of the specified .

  The object for which to get the type handle. 1 RuntimeInfrastructure
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Guid To be added.

  A GUID is associated with a type using the attribute.

  Gets the GUID associated with the .

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is an array, a pointer, or is passed by reference; otherwise, .

  For example, Type.GetType("Int32[]").HasElementType returns true, but Type.GetType("Int32").HasElementType returns false. HasElementType also returns true for "Int32*" and "Int32&".

  If the current represents a generic type, or a type parameter in the definition of a generic type or generic method, this property always returns false.

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

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  For example, Type.GetType("Int32[]").HasElementTypeImpl returns true, but Type.GetType("Int32").HasElementTypeImpl returns false. HasElementTypeImpl also returns true for "Int32*" and "Int32&".

  When overridden in a derived class, implements the property and determines whether the current encompasses or refers to another type; that is, whether the current is an array, a pointer, or is passed by reference.

  true if the is an array, a pointer, or is passed by reference; otherwise, false.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.DebuggerStepThrough
  System.Object `` `` `` `` ``

  is .

  has more than one dimension.

  -or-

  is not a valid value.

  -or-

  The member to be invoked is a constructor and is not specified in .

  -or-

  The member to be invoked is a method that is not a type initializer or instance constructor, and is not specified in .

  -or-

  The member to be accessed is a field, and neither nor is specified in .

  -or-

  The member to be accessed is a property, and neither nor is specified in .

  -or-

  contains and at least one of , , , , or .

  -or-

  contains both and .

  -or-

  contains both and .

  -or-

  contains and at least one of or .

  -or-

  contains and has more than one element.

  A field or property matching the specified criteria was not found.

  A method matching the specified criteria cannot be found.

  -or-

  The current instance object represents a type that contains open type parameters (that is,

  returns

  ).

  The requested member is non-public and the caller does not have the required permission. The member matching the specified criteria cannot be invoked on . The member matching the specified criteria threw an exception. More than one member matches the specified criteria. Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  You cannot use to invoke a generic method.

  The following filter flags can be used to define which members to include in the search:

  Specify BindingFlags.Public to include public members in the search.

  Specify BindingFlags.NonPublic to include non-public members (that is, private and protected members) in the search.

  Specify BindingFlags.FlattenHierarchy to include static members up the hierarchy.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the members declared on the , not members that were simply inherited.

  The following invocation flags can be used to denote what action to take with the member:

  CreateInstance to invoke a constructor. is ignored. Not valid with other invocation flags.

  InvokeMethod to invoke a method, but not a constructor or a type initializer. Not valid with SetField or SetProperty. If InvokeMethod is specified by itself, BindingFlags.Public, BindingFlags.Instance, and BindingFlags.Static are automatically included.

  GetField to get the value of a field. Not valid with SetField.

  SetField to set the value of a field. Not valid with GetField.

  GetProperty to get a property. Not valid with SetProperty.

  SetProperty to set a property. Not valid with GetProperty.

  See for more information.

  A method will be invoked if both of the following conditions are true:

  The number of parameters in the method declaration equals the number of arguments in the array (unless default arguments are defined on the member and BindingFlags.OptionalParamBinding is specified).

  The type of each argument can be converted by the binder to the type of the parameter.

  The binder will find all of the matching methods. These methods are found based upon the type of binding requested ( values InvokeMethod, GetProperty, and so on). The set of methods is filtered by the name, number of arguments, and a set of search modifiers defined in the binder.

  After the method is selected, it is invoked. Accessibility is checked at that point. The search may control which set of methods are searched based upon the accessibility attribute associated with the method. The method of the class is responsible for selecting the method to be invoked. The default binder selects the most specific match.

  Access restrictions are ignored for fully trusted code; that is, private constructors, methods, fields, and properties can be accessed and invoked through whenever the code is fully trusted.

  You can use Type.InvokeMember to set a field to a particular value by specifying . For example, if you want to set a public instance field named F on class C, and F is a String, you can use code such as:

  typeof(C).InvokeMember("F", BindingFlags.SetField, null, c, new Object[] {"strings new value"});

  If F is a String[], you can use code such as:

  typeof(C).InvokeMember("F", BindingFlags.SetField, null, c, new Object[] {new String[]{"a","z","c","d"}});

  which will initialize the field F to this new array. You can also use Type.InvokeMember to set a position in an array by supplying the index of the value and then the next value by using code such as the following:

  typeof(C).InvokeMember("F", BindingFlags.SetField, null, c, new Object[] {1, "b"});

  This will change string "z" in the array that F holds to string "b".

  When you invoke an IDispatch member, you can specify the DispID instead of the member name, using the string format "[DispID=##]". For example, if the DispID of MyComMethod is 3, you can specify the string "[DispID=3]" instead of "MyComMethod". Invoking a member by DispID is faster than looking up the member by name. In complex aggregation scenarios, the DispID is sometimes the only way to invoke the desired member.

  Starting with the net_v20sp1_long, this method can be used to access non-public members if the caller has been granted with the flag and if the grant set of the non-public members is restricted to the caller’s grant set, or a subset thereof. (See Security Considerations for Reflection.)

  To use this functionality, your application should target the net_v35_long or later.

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

  An object representing the return value of the invoked member.

  The string containing the name of the constructor, method, property, or field member to invoke. A bitmask comprised of one or more that specify how the search is conducted. The access can be one of the BindingFlags such as Public, NonPublic, Private, InvokeMethod, GetField, and so on. The type of lookup need not be specified. If the type of lookup is omitted, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static are used. An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. The object on which to invoke the specified member. An array containing the arguments to pass to the member to invoke. 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.DebuggerStepThrough
  System.Object `` `` `` `` `` ``

  is .

  has more than one dimension.

  -or-

  is not a valid value.

  -or-

  The member to be invoked is a constructor and is not specified in .

  -or-

  The member to be invoked is a method that is not a type initializer or instance constructor, and is not specified in .

  -or-

  The member to be accessed is a field, and neither nor is specified in .

  -or-

  The member to be accessed is a property, and neither nor is specified in .

  -or-

  contains and at least one of , , , , or .

  -or-

  contains both and .

  -or-

  contains both and .

  -or-

  contains and at least one of or .

  -or-

  contains and has more than one element.

  A field or property matching the specified criteria was not found.

  A method matching the specified criteria was not found.

  -or-

  The current instance object represents a type that contains open type parameters (that is,

  returns

  ).

  The requested member is non-public and the caller does not have the required permission. The member matching the specified criteria cannot be invoked on . The member matching the specified criteria threw an exception. More than one member matches the specified criteria. Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  For an example that demonstrates , see ( , , , , [], [], , []).

  Although the default binder does not process (the parameter), you can use the abstract class to write a custom binder that does process .

  You cannot use to invoke a generic method.

  The following filter flags can be used to define which members to include in the search:

  Specify BindingFlags.Public to include public members in the search.

  Specify BindingFlags.NonPublic to include non-public members (that is, private, internal, and protected members) in the search.

  Specify BindingFlags.FlattenHierarchy to include static members up the hierarchy.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the members declared on the , not members that were simply inherited.

  The following invocation flags can be used to denote what action to take with the member:

  CreateInstance to invoke a constructor. is ignored. Not valid with other invocation flags.

  InvokeMethod to invoke a method, but not a constructor or a type initializer. Not valid with SetField or SetProperty. If InvokeMethod is specified by itself, BindingFlags.Public, BindingFlags.Instance, and BindingFlags.Static are automatically included.

  GetField to get the value of a field. Not valid with SetField.

  SetField to set the value of a field. Not valid with GetField.

  GetProperty to get a property. Not valid with SetProperty.

  SetProperty to set a property. Not valid with GetProperty.

  See for more information.

  A method will be invoked if both of the following conditions are true:

  The number of parameters in the method declaration equals the number of arguments in the array (unless default arguments are defined on the member and BindingFlags.OptionalParamBinding is specified).

  The type of each argument can be converted by the binder to the type of the parameter.

  The binder will find all of the matching methods. These methods are found based upon the type of binding requested ( values InvokeMethod, GetProperty, and so on). The set of methods is filtered by the name, number of arguments, and a set of search modifiers defined in the binder.

  After the method is selected, it is invoked. Accessibility is checked at that point. The search may control which set of methods are searched based upon the accessibility attribute associated with the method. The method of the class is responsible for selecting the method to be invoked. The default binder selects the most specific match.

  Access restrictions are ignored for fully trusted code; that is, private constructors, methods, fields, and properties can be accessed and invoked through Reflection whenever the code is fully trusted.

  You can use Type.InvokeMember to set a field to a particular value by specifying . For example, if you want to set a public instance field named F on class C, and F is a String you can use code such as:

  typeof(C).InvokeMember("F", BindingFlags.SetField, null, c, new Object[] {"strings new value"}, null);

  If F is a String[], you can use code such as:

  typeof(C).InvokeMember("F", BindingFlags.SetField, null, c, new Object[] {new String[]{"a","z","c","d"}}, null);

  which will initialize the field F to this new array. You can also use Type.InvokeMember to set a position in an array by supplying the index of the value and then the next value by using code such as the following:

  typeof(C).InvokeMember("F", BindingFlags.SetField, null, c, new Object[] {1, "b"}, null);

  This will change string "z" in the array that F holds to string "b".

  When you invoke an IDispatch member you can specify the DispID instead of the member name, using the string format "[DispID=##]". For example, if the DispID of MyComMethod is 3, you can specify the string "[DispID=3]" instead of "MyComMethod". Invoking a member by DispID is faster than looking up the member by name. In complex aggregation scenarios, the DispID is sometimes the only way to invoke the desired member.

  Starting with the net_v20sp1_long, this method can be used to access non-public members if the caller has been granted with the flag and if the grant set of the non-public members is restricted to the caller’s grant set, or a subset thereof. (See Security Considerations for Reflection.)

  To use this functionality, your application should target the net_v35_long or later.

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

  An object representing the return value of the invoked member.

  The string containing the name of the constructor, method, property, or field member to invoke. A bitmask comprised of one or more that specify how the search is conducted. The access can be one of the BindingFlags such as Public, NonPublic, Private, InvokeMethod, GetField, and so on. The type of lookup need not be specified. If the type of lookup is omitted, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static are used. An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. The object on which to invoke the specified member. An array containing the arguments to pass to the member to invoke. The object representing the globalization locale to use, which may be necessary for locale-specific conversions, such as converting a numeric to a . 1 Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object `` `` `` `` `` `` `` ``

  is .

  has more than one dimension.

  -or-

  is not a valid value.

  -or-

  The member to be invoked is a constructor and is not specified in .

  -or-

  The member to be invoked is a method that is not a type initializer or instance constructor, and is not specified in .

  -or-

  The member to be accessed is a field, and neither nor is specified in .

  -or-

  The member to be accessed is a property, and neither nor is specified in .

  -or-

  contains and at least one of , , , , or .

  -or-

  contains both and .

  -or-

  contains both and .

  -or-

  contains and at least one of or .

  -or-

  contains and has more than one element.

  -or-

  .Length > .Length .

  -or-

  At least one element in is .

  -or-

  At least one element in is not assignment-compatible with the corresponding parameter in .

  A field or property matching the specified criteria was not found.

  A method matching the specified criteria cannot be found.

  -or-

  The current instance object represents a type that contains open type parameters (that is,

  returns

  ).

  The requested member is non-public and the caller does not have the required permission. The member matching the specified criteria cannot be invoked on . The member matching the specified criteria threw an exception. More than one member matches the specified criteria. Requires permission to retrieve information on non-public members of types in loaded assemblies. See .

  The following example demonstrates the use of to construct a , obtain its property, invoke on it, and then set its value using the field.

  `using System; using System.Reflection; class InvokeMemberExample { static void Main(string[] args) { // Create the parameter arrays that will // be passed to InvokeMember. char[] cAry = new char[] {'A',' ','s','t','r','i','n','g'}; object[] oAry = new object[] {cAry, 0, cAry.Length}; Type t = typeof(string); // Invoke the constructor of a string. string str = (string)t.InvokeMember(null, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, null, oAry, null, null, null); Console.WriteLine("The string is \"{0}\".", str); // Access a property of the string. int i = (int) t.InvokeMember("Length", BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty, null, str, null, null, null, null); Console.WriteLine("The length of the string is {0}.", i); // Invoke a method on the string. string newStr = "new "; object[] oAry2 = new Object[] {2, newStr}; str = (string) t.InvokeMember("Insert", BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null, str, oAry2, null, null, null); Console.WriteLine("The modified string is \"{0}\".", str); // Access a field of the string. str = (string) t.InvokeMember("Empty", BindingFlags.Static | BindingFlags.Public | BindingFlags.GetField, null, str, null); Console.WriteLine("The empty string is \"{0}\".", str); } }`

  The output is

  The string is "A string".

  The length of the string is 8.

  The modified string is "A new string"

  The empty string is "".

  InvokeMember calls a constructor member or a method member, gets or sets a property member, gets or sets a data field member, or gets or sets an element of an array member.

  You cannot use to invoke a generic method.

  When you invoke an IDispatch member you can specify the DispID instead of the member name, using the string format "[DispID=##]". For example, if the DispID of MyComMethod is 3, you can specify the string "[DispID=3]" instead of "MyComMethod". Invoking a member by DispID is faster than looking up the member by name. In complex aggregation scenarios, the DispID is sometimes the only way to invoke the desired member.

  Although the default binder does not process or (the and parameters), you can use the abstract class to write a custom binder that does process and . ParameterModifier is only used when calling through COM interop, and only parameters that are passed by reference are handled.

  Each parameter in the array gets the value in the corresponding element in the array. If the length of is greater than the length of , the remaining argument values are passed in order.

  The array can be used to change the order of arguments in an input array. For example, given the method M(string a, int b) (M(ByVal a As String, ByVal b As Integer) in Visual Basic) and the input array { 42, "x" }, the input array can be passed unchanged to if the array { "b", "a" } is supplied for .

  The following filter flags can be used to define which members to include in the search:

  Specify BindingFlags.Public to include public members in the search.

  Specify BindingFlags.NonPublic to include non-public members (that is, private, internal, and protected members) in the search.

  Specify BindingFlags.FlattenHierarchy to include static members up the hierarchy.

  The following modifier flags can be used to change how the search works:

  BindingFlags.IgnoreCase to ignore the case of .

  BindingFlags.DeclaredOnly to search only the members declared on the , not members that were simply inherited.

  The following invocation flags can be used to denote what action to take with the member:

  CreateInstance to invoke a constructor. is ignored. Not valid with other invocation flags.

  InvokeMethod to invoke a method, but not a constructor or a type initializer. Not valid with SetField or SetProperty. If InvokeMethod is specified by itself, BindingFlags.Public, BindingFlags.Instance, and BindingFlags.Static are automatically included.

  GetField to get the value of a field. Not valid with SetField.

  SetField to set the value of a field. Not valid with GetField.

  GetProperty to get a property. Not valid with SetProperty.

  SetProperty to set a property. Not valid with GetProperty.

  See for more information.

  A method will be invoked if both of the following conditions are true:

  The number of parameters in the method declaration equals the number of arguments in the array (unless default arguments are defined on the member and BindingFlags.OptionalParamBinding is specified).

  The type of each argument can be converted by the binder to the type of the parameter.

  The binder will find all of the matching methods. These methods are found based upon the type of binding requested ( values InvokeMethod, GetProperty, and so on). The set of methods is filtered by the name, number of arguments, and a set of search modifiers defined in the binder.

  After the method is selected, it is invoked. Accessibility is checked at that point. The search may control which set of methods are searched based upon the accessibility attribute associated with the method. The method of the class is responsible for selecting the method to be invoked. The default binder selects the most specific match.

  InvokeMember can be used to invoke methods with parameters that have default values. To bind to these methods, Reflection requires to be specified. For a parameter that has a default value, you can either supply a different value, or supply to use the default value.

  For example, consider a method such as MyMethod(int x, float y = 2.0). To invoke this method with only the first argument as MyMethod(4), pass one of the above binding flags and pass two arguments, namely, 4 for the first argument and Missing.Value for the second argument. Unless you use Missing.Value, you may not omit optional parameters with the Invoke method. If you must do so, use InvokeMember instead.

  Access restrictions are ignored for fully trusted code; that is, private constructors, methods, fields, and properties can be accessed and invoked through whenever the code is fully trusted.

  You can use Type.InvokeMember to set a field to a particular value by specifying . For example, if you want to set a public instance field named F on class C, and F is a String, you can use code such as:

  typeof(C).InvokeMember("F", BindingFlags.SetField, null, c, new Object[] {"strings new value"}, null, null, null);

  If F is a String[], you can use code such as:

  typeof(C).InvokeMember("F", BindingFlags.SetField, null, c, new Object[] {new String[]{"a","z","c","d"}}, null, null, null);

  which will initialize the field F to this new array. You can also use Type.InvokeMember to set a position in an array by supplying the index of the value and then the next value by using code such as the following:

  typeof(C).InvokeMember("F", BindingFlags.SetField, null, c, new Object[] {1, "b"}, null, null, null);

  This will change string "z" in the array that F holds to string "b".

  Starting with the net_v20sp1_long, this method can be used to access non-public members if the caller has been granted with the flag and if the grant set of the non-public members is restricted to the caller’s grant set, or a subset thereof. (See Security Considerations for Reflection.)

  To use this functionality, your application should target the net_v35_long or later.

  When overridden in a derived class, invokes the specified member, using the specified binding constraints and matching the specified argument list, modifiers and culture.

  An object representing the return value of the invoked member.

  The string containing the name of the constructor, method, property, or field member to invoke. A bitmask comprised of one or more that specify how the search is conducted. The access can be one of the BindingFlags such as Public, NonPublic, Private, InvokeMethod, GetField, and so on. The type of lookup need not be specified. If the type of lookup is omitted, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static are used. An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection. The object on which to invoke the specified member. An array containing the arguments to pass to the member to invoke. An array of objects representing the attributes associated with the corresponding element in the array. A parameter's associated attributes are stored in the member's signature. The object representing the globalization locale to use, which may be necessary for locale-specific conversions, such as converting a numeric String to a Double. An array containing the names of the parameters to which the values in the array are passed. 1 Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is abstract; otherwise, .

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  Gets a value indicating whether the is abstract and must be overridden.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean if the type attribute is selected for the current type; otherwise, .

  The selects the string format attributes. The string format attributes enhance interoperability by defining how strings should be interpreted.

  If the current represents a generic type, this property pertains to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter of a generic type, this property always returns false.

  Gets a value indicating whether the string format attribute AnsiClass is selected for the .

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the current represents an array; otherwise .

  The following example demonstrates using the property.

  `using System; class TestType { public static void Main() { int [] array = {1,2,3,4}; Type at = typeof(Array); Type t = array.GetType(); Console.WriteLine("Type is {0}. IsArray? {1}", at, at.IsArray); Console.WriteLine("Type is {0}. IsArray? {1}", t, t.IsArray); } }`

  The output is

  Type is System.Array. IsArray? False

  Type is System.Int32[]. IsArray? True

  The property returns false for the class.

  To check for an array, use code such as typeof(Array).IsAssignableFrom(type).

  If the current represents a generic type, or a type parameter in the definition of a generic type or generic method, this property always returns false.

  This property is read-only.

  Gets a value indicating whether the is an array.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  An instance of the class must return false because it is an object, not an array.

  When overridden in a derived class, implements the property and determines whether the is an array.

  true if the is an array; otherwise, false.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  The following example demonstrates the method using arrays.

  `using System; class ArrayTypeTest { public static void Main() { int i = 1; int [] array10 = new int [10]; int [] array2 = new int[2]; int [,]array22 = new int[2,2]; int [,]array24 = new int[2,4]; int [,,]array333 = new int[3,3,3]; Type array10Type = array10.GetType(); Type array2Type = array2.GetType(); Type array22Type = array22.GetType(); Type array24Type = array24.GetType(); Type array333Type = array333.GetType(); // If X and Y are not both arrays, then false Console.WriteLine("int[2] is assignable from int? {0} ", array2Type.IsAssignableFrom(i.GetType())); // If X and Y have same type and rank, then true. Console.WriteLine("int[2] is assignable from int[10]? {0} ", array2Type.IsAssignableFrom(array10Type)); Console.WriteLine("int[2,2] is assignable from int[2,4]? {0}", array22Type.IsAssignableFrom(array24Type)); Console.WriteLine("int[2,4] is assignable from int[2,2]? {0}", array24Type.IsAssignableFrom(array22Type)); Console.WriteLine(""); // If X and Y do not have the same rank, then false. Console.WriteLine("int[2,2] is assignable from int[10]? {0}", array22Type.IsAssignableFrom(array10Type)); Console.WriteLine("int[2,2] is assignable from int[3,3,3]? {0}", array22Type.IsAssignableFrom(array333Type)); Console.WriteLine("int[3,3,3] is assignable from int[2,2]? {0}", array333Type.IsAssignableFrom(array22Type)); } }`

  The output is

  int[2] is assignable from int? False

  int[2] is assignable from int[10]? True

  int[2,2] is assignable from int[2,4]? True

  int[2,4] is assignable from int[2,2]? True

  int[2,2] is assignable from int[10]? False

  int[2,2] is assignable from int[3,3,3]? False

  int[3,3,3] is assignable from int[2,2]? False

  This method can be overridden by a derived class.

  A generic type definition is not assignable from a closed constructed type. That is, you cannot assign the closed constructed type MyGenericList<int> (MyGenericList(Of Integer) in Visual Basic) to a variable of type MyGenericList<T>.

  You can determine the element types of a Type using .

  If the parameter is of type , the result is based on the type that is to be built. The following code example demonstrates this using a built type named B.

  `TypeBuilder b1 = moduleBuilder.DefineType("B", TypeAttributes.Public, typeof(A)); // Returns true: typeof(A).IsAssignableFrom(b1))`

  Determines whether an instance of the current can be assigned from an instance of the specified Type.

  true if and the current Type represent the same type, or if the current Type is in the inheritance hierarchy of , or if the current Type is an interface that implements, or if is a generic type parameter and the current Type represents one of the constraints of , or if represents a value type and the current Type represents Nullable<c> (Nullable(Of c) in Visual Basic). false if none of these conditions are true, or if is null.

  The type to compare with the current type. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean if the type attribute is selected for the current type; otherwise, .

  The selects the string format attributes. The string format attributes enhance interoperability by defining how strings should be interpreted.

  If the current represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter of a generic type, this property always returns false.

  Gets a value indicating whether the string format attribute AutoClass is selected for the .

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the type layout attribute is specified for the current ; otherwise, .

  This property is provided as a convenience. Alternatively, you can use the enumeration value to select the type layout attributes, and then test whether is set. The , , and enumeration values indicate the way the fields of the type are laid out in memory.

  For dynamic types, you can specify when you create the type. In code, apply the attribute with the enumeration value to the type, to let the runtime determine the appropriate way to lay out the class.

  You cannot use the method to determine whether the has been applied to a type.

  If the current represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  Gets a value indicating whether the fields of the current type are laid out automatically by the common language runtime.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is passed by reference; otherwise, .

  To get to the actual type, dereference the type that was passed by reference, and then call on that type.

  Gets a value indicating whether the is passed by reference.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  As described above.

  When overridden in a derived class, implements the property and determines whether the is passed by reference.

  true if the is passed by reference; otherwise, false.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the current represents a class; otherwise .

  This property returns true for value types even if they are boxed.

  The distinguishes a type declaration as class, interface, or value type.

  If the current represents a constructed generic type, this property returns true if the generic type definition is a class definition; that is, it does not define an interface or a value type.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  This property returns true for Type instances that represent the and classes. These two classes are the base types for enumerations and value types, respectively, but they are not enumerations or value types themselves. For more information, see the and properties.

  This property is read-only.

  Gets a value indicating whether the is a class; that is, not a value type or interface.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  This method returns false for COM interfaces because they are not objects. COM interfaces can be implemented by Microsoft .NET Framework objects.

  You can also load a COM class and get a Type object for that COM class by using the [<topic://cpgrftypelibraryimportertlbimpexe>] tool.

  If the current represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  Gets a value indicating whether the is a COM object.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  This method returns false for COM interfaces because they are not objects. COM interfaces can be implemented by Microsoft .NET Framework objects.

  When overridden in a derived class, implements the property and determines whether the is a COM object.

  true if the is a COM object; otherwise, false.

  1
  Reflection
- Property
  4.0.0.0
  System.Boolean To be added.

  A constructed generic type has had explicit types supplied for all of its generic type parameters. It is also referred to as a closed generic type.

  When this property is true, you can create instances of the current type; when it is false, you can't.

  Gets a value that indicates whether this object represents a constructed generic type. You can create instances of a constructed generic type.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  A context intercepts calls to the class members and enforces policies that are applied to the class, such as synchronization. For more detailed information on remoting contexts, see .

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

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

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  This method can be overridden by a derived class.

  A context intercepts calls to the class members and enforce policies that are applied to the class, such as synchronization.

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

  true if the can be hosted in a context; otherwise, false.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the current represents an enumeration; otherwise .

  The following example demonstrates using the property.

  `using System; public enum Color { Red, Blue, Green } class TestType { public static void Main() { Type colorType = typeof(Color); Type enumType = typeof(Enum); Console.WriteLine("Color is enum ? {0}", colorType.IsEnum); Console.WriteLine("Color is valueType? {0}", colorType.IsValueType); Console.WriteLine("Enum is enum Type? {0}", enumType.IsEnum); Console.WriteLine("Enum is value? {0}", enumType.IsValueType); } }`

  The output is

  Color is enum ? True

  Color is valueType? True

  Enum is enum Type? False

  Enum is value? False

  This property returns true for an enumeration, but not for the type itself.

  If the current represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  This property is read-only.

  Gets a value indicating whether the current represents an enumeration.

  0
- Method
  4.0.0.0
  System.Boolean `` To be added.

  Returns a value that indicates whether the specified value exists in the current enumeration type.

  true if the specified value is a member of the current enumeration type; otherwise, false.

  The value to be tested.
- Method
  4.0.0.0
  System.Boolean ``

  Beginning with the net_v40_long, the common language runtime supports the embedding of type information for COM types directly into managed assemblies, instead of requiring the managed assemblies to obtain type information for COM types from interop assemblies. Because the embedded type information includes only the types and members that are actually used by a managed assembly, two managed assemblies might have very different views of the same COM type. Each managed assembly has a different object to represent its view of the COM type. The common language runtime supports type equivalence between these different views for interfaces, structures, enumerations, and delegates.

  Type equivalence means that a COM object that is passed from one managed assembly to another can be cast to the appropriate managed type in the receiving assembly. The method enables an assembly to determine that a COM object obtained from another assembly has the same COM identity as one of the first assembly's own embedded interop types, and thus can be cast to that type.

  For more information, see Type Equivalence and Embedded Interop Types.

  Determines whether two COM types have the same identity and are eligible for type equivalence.

  true if the COM types are equivalent; otherwise, false. This method also returns false if one type is in an assembly that is loaded for execution, and the other is in an assembly that is loaded into the reflection-only context.

  The COM type that is tested for equivalence with the current type.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the type layout attribute is specified for the current ; otherwise, .

  This property is provided as a convenience. Alternatively, you can use the enumeration value to select the type layout attributes, and then test whether is set. The , , and enumeration values indicate the way the fields of the type are laid out in memory.

  For dynamic types, you can specify when you create the type. In code, apply the attribute with the enumeration value to the type, to specify that the offsets at which the fields start are specified explicitly.

  You cannot use the method to determine whether the has been applied to a type.

  If the current represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  Gets a value indicating whether the fields of the current type are laid out at explicitly specified offsets.

  1
  Reflection
- Property
  2.0.0.0
  4.0.0.0
  System.Boolean if the current object represents a type parameter of a generic type or method; otherwise .

  For an example of using this method, see the example for .

  objects that represent generic type parameters can be obtained by calling the method of a object that represents a generic type definition, or the method of a object that represents a generic method definition.

  For a generic type or method definition, the property returns true for every element of the resulting array.

  For a closed constructed type or method, the property returns false for every element of the array returned by the method.

  For an open constructed type or method, some elements of the array might be specific types and others might be type parameters. returns false for the types and true for the type parameters. The code example for the property demonstrates a generic class with a mixture of types and type parameters.

  For a list of the invariant conditions for terms used in generic reflection, see the property remarks.

  Gets a value indicating whether the current represents a type parameter in the definition of a generic type or method.

- Property
  2.0.0.0
  4.0.0.0
  System.Boolean if the current type has type arguments; otherwise .

  For an example of using this method, see the example for .

  Use the property to determine whether a object represents a generic type. Use the property to determine whether a object represents an open constructed type or a closed constructed type.

  The property returns false if the immediate type is not generic. For example, an array whose elements are of type A<int> (A(Of Integer) in Visual Basic) is not itself a generic type.

  The following table summarizes the invariant conditions for common terms used in generic reflection.

  Term

  Invariant

  generic type definition

  The property is true.

  Defines a generic type. A constructed type is created by calling the method on a object that represents a generic type definition and specifying an array of type arguments.

  can be called only on generic type definitions.

  Any generic type definition is a generic type (the property is true), but the converse is not true.

  generic type

  The property is true.

  Can be a generic type definition, an open constructed type, or a closed constructed type.

  Note that an array type whose element type is generic is not itself a generic type. The same is true of a object representing a pointer to a generic type.

  open constructed type

  The property is true.

  Examples are a generic type that has unassigned type parameters, a type that is nested in a generic type definition or in an open constructed type, or a generic type that has a type argument for which the property is true.

  It is not possible to create an instance of an open constructed type.

  Note that not all open constructed types are generic. For example, an array whose element type is a generic type definition is not generic, and a pointer to an open constructed type is not generic.

  closed constructed type

  The property is false.

  When examined recursively, the type has no unassigned generic parameters.

  generic type parameter

  The property is true.

  The property is true.

  In a generic type definition, a placeholder for a type that will be assigned later.

  generic type argument

  Can be any type, including a generic type parameter.

  Type arguments are specified as an array of objects passed to the method when creating a constructed generic type. If instances of the resulting type are to be created, the property must be false for all the type arguments.

  The following code example and table illustrate some of these terms and invariants. The Derived class is of particular interest because its base type is a constructed type that has a mixture of types and type parameters in its type argument list.

  code reference: System.Type.IsGenericType#2

  The following table shows examples that use and build on the classes Base, Derived, and G. When the C++ and C# code is the same, only one entry is shown.

  Example

  Invariants

  Derived(Of V)

  Derived<V>

  For this type:

  is true.

  is true.

  is true.

  Base(Of String, V)

  Base<String,V>

  Base<String^,V>

  For this type:

  is true.

  is false.

  is true.

  Dim d() As Derived(Of Integer)

  Derived<int>[] d;

  array<Derived<int>^>^ d;

  For the type of variable d:

  is false because d is an array.

  is false.

  is false.

  T, U, and V (everywhere they appear)

  is true.

  is false because there is no way to constrain a type parameter to generic types.

  is false.

  is true because T, U, and V are themselves generic type parameters. This does not imply anything about type arguments that are assigned to them later.

  The type of field F

  is true.

  is false because a type has been assigned to to the type parameter of G. Note that this is equivalent to having called the method.

  is true because the type of field F has a type argument that is an open constructed type. The constructed type is open because its type argument (that is, Base) is a generic type definition. This illustrates the recursive nature of the property.

  The nested class Nested

  is true, even though the Nested class has no generic type parameters of its own, because it is nested in a generic type.

  is true. That is, you can call the method and supply the type parameter of the enclosing type, Derived.

  is true because the enclosing type, Derived, has generic type parameters. This illustrates the recursive nature of the property.

  Gets a value indicating whether the current type is a generic type.

- Property
  2.0.0.0
  4.0.0.0
  System.Boolean if the current object represents the definition of a generic type, none of whose type parameters have been bound to specific types; otherwise .

  For an example of using this method, see the example for .

  A generic type definition is a template from which other types can be constructed. For example, from the generic type definition G<T> (expressed in C# syntax; G(Of T) in Visual Basic or generic <typename T> ref class G in C++) you can construct and instantiate the type G<int> (G(Of Integer) in Visual Basic), by calling the method with a generic argument list containing the type. Given a object representing this constructed type, the method gets the generic type definition back again.

  Use the property to determine whether you can create new types from the current type. If the property returns true, you can call the method to create new generic types.

  For a list of the invariant conditions for terms used in generic reflection, see the property remarks.

  Gets a value indicating whether the current represents a generic type definition, from which other generic types can be constructed.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the was imported from another class; otherwise, .

  If the current represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  Gets a value indicating whether the has a attribute applied, indicating that it was imported from a COM type library.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  The following example demonstrates the method.

  `using System; public interface IFoo { } public class MyClass : IFoo {} public class MyDerivedClass : MyClass {} class IsInstanceTest { public static void Main() { Type ifooType=typeof(IFoo); MyClass mc = new MyClass(); Type mcType = mc.GetType(); MyClass mdc = new MyDerivedClass(); Type mdcType = mdc.GetType(); int [] array = new int [10]; Type arrayType = typeof(Array); Console.WriteLine("int[] is instance of Array? {0}", arrayType.IsInstanceOfType(array)); Console.WriteLine("myclass instance is instance of MyClass? {0}", mcType.IsInstanceOfType(mc)); Console.WriteLine("myderivedclass instance is instance of MyClass? {0}", mcType.IsInstanceOfType(mdc)); Console.WriteLine("myclass instance is instance of IFoo? {0}", ifooType.IsInstanceOfType(mc)); Console.WriteLine("myderivedclass instance is instance of IFoo? {0}", ifooType.IsInstanceOfType(mdc)); } }`

  The output is

  int[] is instance of Array? True

  myclass instance is instance of MyClass? True

  myderivedclass instance is instance of MyClass? True

  myclass instance is instance of IFoo? True

  myderivedclass instance is instance of IFoo? True

  This method can be overridden by a derived class.

  A constructed type is not an instance of its generic type definition. That is, MyGenericList<int> (MyGenericList(Of Integer) in Visual Basic) is not an instance of MyGenericList<T> (MyGenericList(Of T) in Visual Basic).

  Determines whether the specified object is an instance of the current .

  true if the current Type is in the inheritance hierarchy of the object represented by , or if the current Type is an interface that supports. false if neither of these conditions is the case, or if is null, or if the current Type is an open generic type (that is, returns true).

  The object to compare with the current type. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the current represents an interface; otherwise .

  The distinguishes a type declaration as class, interface or value type.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  This property is read-only.

  Gets a value indicating whether the is an interface; that is, not a class or a value type.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the type layout attribute is specified for the current ; otherwise, .

  This property is provided as a convenience. Alternatively, you can use the enumeration value to select the type layout attributes, and then test whether is set. The , , and enumeration values indicate the way the fields of the type are laid out in memory.

  For dynamic types, you can specify when you create the type. In code, apply the attribute with the enumeration value to the type, to specify that layout is sequential.

  You cannot use the method to determine whether the has been applied to a type.

  For more information, see section 9.1.2 of the specification for the Common Language Infrastructure (CLI) documentation, "Partition II: Metadata Definition and Semantics". The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

  If the current represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  Gets a value indicating whether the fields of the current type are laid out sequentially, in the order that they were defined or emitted to the metadata.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is marshaled by reference; otherwise, .

  This property is read-only.

  Gets a value indicating whether the is marshaled by reference.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  This method can be overridden by a derived class.

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

  true if the is marshaled by reference; otherwise, false.

- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  The property returns true for all nested types, regardless of visibility. To test for nesting and visibility at the same time, use the related properties , , , , , or .

  The enumeration member selects the visibility attributes for a type.

  Gets a value indicating whether the current object represents a type whose definition is nested inside the definition of another type.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is nested and visible only within its own assembly; otherwise, .

  If the current represents a type parameter of a generic type, this property always returns false.

  selects the visibility attributes.

  Gets a value indicating whether the is nested and visible only within its own assembly.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is nested and visible only to classes that belong to both its own family and its own assembly; otherwise, .

  If the current represents a type parameter of a generic type, this property always returns false.

  selects the visibility attributes.

  A object's family is defined as all objects of the exact same and of its subtypes.

  Gets a value indicating whether the is nested and visible only to classes that belong to both its own family and its own assembly.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is nested and visible only within its own family; otherwise, .

  If the current represents a type parameter of a generic type, this property always returns false.

  selects the visibility attributes.

  A object's family is defined as all objects of the exact same and of its subtypes.

  Gets a value indicating whether the is nested and visible only within its own family.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is nested and visible only to classes that belong to its own family or to its own assembly; otherwise, .

  If the current represents a type parameter of a generic type, this property always returns false.

  selects the visibility attributes.

  A object's family is defined as all objects of the exact same and of its subtypes.

  Gets a value indicating whether the is nested and visible only to classes that belong to either its own family or to its own assembly.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is nested and declared private; otherwise, .

  If the current represents a type parameter of a generic type, this property always returns false.

  selects the visibility attributes.

  Gets a value indicating whether the is nested and declared private.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the class is nested and declared public; otherwise, .

  If the current represents a type parameter of a generic type, this property always returns false.

  selects the visibility attributes.

  Gets a value indicating whether a class is nested and declared public.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the top-level is not declared public; otherwise, .

  Do not use with nested types; use instead.

  If the current represents a type parameter of a generic type, this property returns false.

  selects the visibility attributes.

  Gets a value indicating whether the is not declared public.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  This property is read-only.

  if the current represents a pointer; otherwise .

  If the current represents a generic type, or a type parameter in the definition of a generic type or generic method, this property always returns false.

  This property is read-only.

  Gets a value indicating whether the is a pointer.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  As described above.

  When overridden in a derived class, implements the property and determines whether the is a pointer.

  true if the is a pointer; otherwise, false.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is one of the primitive types; otherwise, .

  The primitive types are , , , , , , , , , , , , , and .

  If the current represents a generic type, or a type parameter in the definition of a generic type or generic method, this property always returns false.

  Gets a value indicating whether the is one of the primitive types.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  The primitive types are , , , , , , , , , , , and .

  When overridden in a derived class, implements the property and determines whether the is one of the primitive types.

  true if the is one of the primitive types; otherwise, false.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the top-level is declared public; otherwise, .

  Do not use with nested types; use instead.

  If the current represents a type parameter of a generic type, this property returns true.

  selects the visibility attributes.

  Gets a value indicating whether the is declared public.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the is declared sealed; otherwise, .

  If the current represents a type parameter of a generic type, this property always returns true.

  Gets a value indicating whether the is declared sealed.

  1
  Reflection
- Property
  4.0.0.0
  System.Boolean To be added.

  The , , and properties report the transparency level of the type at its current trust level, as determined by the common language runtime (CLR). The combinations of these properties are shown in the following table:

  Security level

  IsSecurityCritical

  IsSecuritySafeCritical

  IsSecurityTransparent

  Critical

  true

  false

  false

  Safe critical

  true

  true

  false

  Transparent

  false

  false

  true

  Using these properties is much simpler than examining the security annotations of an assembly and its types, checking the current trust level, and attempting to duplicate the runtime's rules.

  For partial-trust assemblies, the value of this property depends on the current trust level of the assembly. If the assembly is loaded into a partially trusted application domain (for example, into a sandboxed application domain), then the runtime ignores the security annotations of the assembly. The assembly and all its types are treated as transparent. The runtime pays attention to the security annotations of a partial-trust assembly only when that assembly is loaded into a fully trusted application domain (for example, into the default application domain of a desktop application). By contrast, a trusted assembly (that is, a strong-named assembly that is installed in the global assembly cache) is always loaded with full trust regardless of the trust level of the application domain, so its current trust level is always fully trusted. You can determine the current trust levels of assemblies and application domains by using the and properties.

  For more information about reflection and transparency, see Security Considerations for Reflection. For information about transparency, see Security Changes in the .NET Framework Version 4.0.

  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.

- Property
  4.0.0.0
  System.Boolean To be added.

  The , , and properties report the transparency level of the type at its current trust level, as determined by the common language runtime (CLR). The combinations of these properties are shown in the following table:

  Security level

  IsSecurityCritical

  IsSecuritySafeCritical

  IsSecurityTransparent

  Critical

  true

  false

  false

  Safe critical

  true

  true

  false

  Transparent

  false

  false

  true

  Using these properties is much simpler than examining the security annotations of an assembly and its types, checking the current trust level, and attempting to duplicate the runtime's rules.

  For partial-trust assemblies, the value of this property depends on the current trust level of the assembly. If the assembly is loaded into a partially trusted application domain (for example, into a sandboxed application domain), then the runtime ignores the security annotations of the assembly. The assembly and all its types are treated as transparent. The runtime pays attention to the security annotations of a partial-trust assembly only when that assembly is loaded into a fully trusted application domain (for example, into the default application domain of a desktop application). By contrast, a trusted assembly (that is, a strong-named assembly that is installed in the global assembly cache) is always loaded with full trust regardless of the trust level of the application domain, so its current trust level is always fully trusted. You can determine the current trust levels of assemblies and application domains by using the and properties.

  For more information about reflection and transparency, see Security Considerations for Reflection. For information about transparency, see Security Changes in the .NET Framework Version 4.0.

  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.

- Property
  4.0.0.0
  System.Boolean To be added.

  If this property returns true, the and properties return false.

  The , , and properties report the transparency level of the type at its current trust level, as determined by the common language runtime (CLR). Using these properties is much simpler than examining the security annotations of an assembly and its types, checking the current trust level, and attempting to duplicate the runtime's rules.

  For partial-trust assemblies, the value of this property depends on the current trust level of the assembly. If the assembly is loaded into a partially trusted application domain (for example, into a sandboxed application domain), then the runtime ignores the security annotations of the assembly. The assembly and all its types are treated as transparent. The runtime pays attention to the security annotations of a partial-trust assembly only when that assembly is loaded into a fully trusted application domain (for example, into the default application domain of a desktop application). By contrast, a trusted assembly (that is, a strong-named assembly that is installed in the global assembly cache) is always loaded with full trust regardless of the trust level of the application domain, so its current trust level is always fully trusted. You can determine the current trust levels of assemblies and application domains by using the and properties.

  For more information about reflection and transparency, see Security Considerations for Reflection. For information about transparency, see Security Changes in the .NET Framework Version 4.0.

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

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  If the current represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  Gets a value indicating whether the is serializable.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the has a name that requires special handling; otherwise, .

  Names that begin with or contain an underscore character (_), property accessors, and operator overloading methods are examples of types that might require special treatment by some compilers.

  If the current represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  Gets a value indicating whether the has a name that requires special handling.

  1
  Reflection
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
  System.Boolean ``

  The following example demonstrates the method.

  `using System; public interface IFoo { } public interface IBar:IFoo{} public class MyClass : IFoo {} public class MyDerivedClass : MyClass {} class IsSubclassTest { public static void Main() { Type ifooType = typeof(IFoo); Type ibarType = typeof(IBar); MyClass mc = new MyClass(); Type mcType = mc.GetType(); MyClass mdc = new MyDerivedClass(); Type mdcType = mdc.GetType(); int [] array = new int [10]; Type arrayOfIntsType = array.GetType(); Type arrayType = typeof(Array); Console.WriteLine("Array is subclass of int[]? {0}", arrayType.IsSubclassOf(arrayOfIntsType)); Console.WriteLine("int [] is subclass of Array? {0}", arrayOfIntsType.IsSubclassOf(arrayType)); Console.WriteLine("IFoo is subclass of IBar? {0}", ifooType.IsSubclassOf(ibarType)); Console.WriteLine("myclass is subclass of MyClass? {0}", mcType.IsSubclassOf(mcType)); Console.WriteLine("myderivedclass is subclass of MyClass? {0}", mdcType.IsSubclassOf(mcType)); Console.WriteLine("IBar is subclass of IFoo? {0}", ibarType.IsSubclassOf(ifooType)); } }`

  The output is

  Array is subclass of int[]? False

  int [] is subclass of Array? True

  IFoo is subclass of IBar? False

  myclass is subclass of MyClass? False

  myderivedclass is subclass of MyClass? True

  IBar is subclass of IFoo? False

  The method cannot be used to determine whether an interface derives from another interface, or whether a class implements an interface. Use the method for that purpose. Note that if a type is dervived from an interface, this method returns true for that type being a subclass of .

  If the current represents a type parameter in the definition of a generic type or generic method, it derives from its class constraint or from if it has no class constraint.

  If the is the converse of . That is, if t1.IsSubclassOf(t2) is true, then t2.IsAssignableFrom(t1) is also true.

  This method can be overridden by a derived class.

  Determines whether the class represented by the current derives from the class represented by the specified .

  true if the Type represented by the parameter and the current Type represent classes, and the class represented by the current Type derives from the class represented by ; otherwise, false. This method also returns false if and the current Type represent the same class.

  The type to compare with the current type. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean if the type attribute is selected for the current type; otherwise, .

  The is used to select the string format attributes. The string format attributes enhance interoperability by defining how strings should be interpreted.

  If the current represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns false.

  Gets a value indicating whether the string format attribute UnicodeClass is selected for the .

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the current represents a value type (structure); otherwise .

  Value types are types that are represented as sequences of bits; value types are not classes or interfaces. Value types are referred to as "structs" in some programming languages. Enums are a special case of value types.

  This property returns false for the class, because is not a value type itself. It is the base class for all value types, and therefore any value type can be assigned to it. This would not be possible if itself was a value type. Value types are boxed when they are assigned to a field of type .

  This property returns true for enumerations, but not for the type itself. For an example that demonstrates this behavior, see .

  This property is read-only.

  Gets a value indicating whether the is a value type.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  This method is provided to enable the implementation of alternate type systems. It is not generally used in application code.

  Implements the property and determines whether the is a value type; that is, not a class or an interface.

  true if the is a value type; otherwise, false.

- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  Use this property to determine whether a type is part of the public interface of a component assembly.

  Gets a value indicating whether the can be accessed by code outside the assembly.

- Method
  2.0.0.0
  4.0.0.0
  System.Type

  The method provides a way to generate array types whose element types are computed at run time.

  Note The common language runtime makes a distinction between vectors (that is, one-dimensional arrays that are always zero-based) and multidimensional arrays. A vector, which always has only one dimension, is not the same as a multidimensional array that happens to have only one dimension. This method overload can only be used to create vector types, and it is the only way to create a vector type. Use the method overload to create multidimensional array types.

  Returns a object representing a one-dimensional array of the current type, with a lower bound of zero.

  A object representing a one-dimensional array of the current type, with a lower bound of zero.

- Method
  2.0.0.0
  4.0.0.0
  System.Type ``

  is invalid (being less than 1, for example).

  The method provides a way to generate array types whose element types are computed at run time.

  The common language runtime makes a distinction between vectors (that is, one-dimensional arrays that are always zero-based) and multidimensional arrays. A vector, which always has only one dimension, is not the same as a multidimensional array that happens to have only one dimension. You cannot use this method overload to create a vector type; if is 1, this method overload returns a multidimensional array type that happens to have one dimension. Use the method overload to create vector types.

  Returns a object representing an array of the current type, with the specified number of dimensions.

  An object representing an array of the current type, with the specified number of dimensions.

  The number of dimensions for the array. This number must be less than or equal to 32.
- Method
  2.0.0.0
  4.0.0.0
  System.Type

  The method provides a way to generate ref types (ByRef in Visual Basic) for parameter lists.

  Using the syntax of Microsoft intermediate language (MSIL), if the current object represents , this method returns a object representing Int32&.

  Returns a object that represents the current type when passed as a ref parameter (ByRef parameter in Visual Basic).

  A object that represents the current type when passed as a ref parameter (ByRef parameter in Visual Basic).

- Method
  2.0.0.0
  4.0.0.0
  System.Type `System.ParamArray`

  The number of elements in is not the same as the number of type parameters of the current generic type definition.

  -or-

  An element of does not satisfy the constraints specified for the corresponding type parameter of the current generic type definition.

  is .

  -or-

  An element of is .

  The current type does not represent the definition of a generic type. That is, returns .

  The following example uses and to create a constructed type from the generic type. The constructed type represents a of objects with string keys.

  `using System; using System.Reflection; using System.Collections.Generic; public class Test { public static void Main() { Console.WriteLine("\n--- Create a constructed type from the generic Dictionary type."); // Create a type object representing the generic Dictionary // type. Type generic = Type.GetType("System.Collections.Generic.Dictionary"); DisplayTypeInfo(generic); // Create an array of types to substitute for the type // parameters of Dictionary. The key is of type string, and // the type to be contained in the Dictionary is Test. Type[] typeArgs = { typeof(string), typeof(Test) }; Type constructed = generic.MakeGenericType(typeArgs); DisplayTypeInfo(constructed); // Compare the type objects obtained above to type objects // obtained using typeof() and GetGenericTypeDefinition(). Console.WriteLine("\n--- Compare types obtained by different methods:"); Type t = typeof(Dictionary<string, Test>); Console.WriteLine("\tAre the constructed types equal? {0}", t == constructed); Console.WriteLine("\tAre the generic types equal? {0}", t.GetGenericTypeDefinition() == generic); } private static void DisplayTypeInfo(Type t) { Console.WriteLine("\n{0}", t); Console.WriteLine("\tIs this a generic type definition? {0}", t.IsGenericTypeDefinition); Console.WriteLine("\tDoes it have generic type arguments? {0}", t.HasGenericArguments); Type[] typeArguments = t.GetGenericArguments(); Console.WriteLine("\tList type arguments ({0}):", typeArguments.Length); foreach (Type tParam in typeArguments) { Console.WriteLine("\t\t{0}", tParam); } } } /* This example produces the following output: --- Create a constructed type from the generic Dictionary type. System.Collections.Generic.Dictionary[KeyType,ValueType] Is this a generic type definition? True Does it have generic type arguments? True List type arguments (2): K V System.Collections.Generic.Dictionary[System.String, Test] Is this a generic type definition? False Does it have generic type arguments? True List type arguments (2): System.String Test --- Compare types obtained by different methods: Are the constructed types equal? True Are the generic types equal? True */`

  The method allows you to write code that assigns specific types to the type parameters of a generic type definition, thus creating a object that represents a particular constructed type. You can use this object to create run-time instances of the constructed type.

  Types constructed with can be open, that is, some of their type arguments can be type parameters of enclosing generic methods or types. You might use such open constructed types when you emit dynamic assemblies. For example, consider the classes Base and Derived in the following code.

  code reference: System.Type.MakeGenericType#1

  To generate Derived in a dynamic assembly, it is necessary to construct its base type. To do this, call the method on a object representing the class Base, using the generic type arguments and the type parameter V from Derived. Because types and generic type parameters are both represented by objects, an array containing both can be passed to the method.

  A constructed type such as Base<int, V> is useful when emitting code, but you cannot call the method on this type because it is not a generic type definition. To create a closed constructed type that can be instantiated, first call the method to get a object representing the generic type definition and then call with the desired type arguments.

  The object returned by is the same as the obtained by calling the method of the resulting constructed type, or the method of any constructed type that was created from the same generic type definition using the same type arguments.

  An array of generic types is not itself a generic type. You cannot call on an array type such as C<T>[] (Dim ac() As C(Of T) in Visual Basic). To construct a closed generic type from C<T>[], call to obtain the generic type definition C<T>; call on the generic type definition to create the constructed type; and finally call the method on the constructed type to create the array type. The same is true of pointer types and ref types (ByRef in Visual Basic).

  For a list of the invariant conditions for terms used in generic reflection, see the property remarks.

  ## Nested Types

  If a generic type is defined using C#, C++, or Visual Basic, then its nested types are all generic. This is true even if the nested types have no type parameters of their own, because all three languages include the type parameters of enclosing types in the type parameter lists of nested types. Consider the following classes:

  code reference: System.Type.MakeGenericType#2

  The type parameter list of the nested class Inner has two type parameters, and , the first of which is the type parameter of its enclosing class. Similarly, the type parameter list of the nested class Innermost1 has three type parameters, , , and , with and coming from its enclosing classes. The nested class Innermost2 has two type parameters, and , which come from its enclosing classes.

  If the parameter list of the enclosing type has more than one type parameter, all the type parameters in order are included in the type parameter list of the nested type.

  To construct a generic type from the generic type definition for a nested type, call the method with the array formed by concatenating the type argument arrays of all the enclosing types, beginning with the outermost generic type, and ending with the type argument array of the nested type itself, if it has type parameters of its own. To create an instance of Innermost1, call the method with an array containing three types, to be assigned to T, U, and V. To create an instance of Innermost2, call the method with an array containing two types, to be assigned to T and U.

  The languages propagate the type parameters of enclosing types in this fashion so you can use the type parameters of an enclosing type to define fields of nested types. Otherwise, the type parameters would not be in scope within the bodies of the nested types. It is possible to define nested types without propagating the type parameters of enclosing types, by emitting code in dynamic assemblies or by using the MSIL Assembler (Ilasm.exe). Consider the following code for the MSIL assembler:

  `.class public Outer<T> { .class nested public Inner<U> { .class nested public Innermost { } } }`

  In this example, it is not possible to define a field of type or in class Innermost, because those type parameters are not in scope. The following assembler code defines nested classes that behave the way they would if defined in C++, Visual Basic, and C#:

  `.class public Outer<T> { .class nested public Inner<T, U> { .class nested public Innermost<T, U, V> { } } }`

  You can use the MSIL Disassembler (Ildasm.exe) to examine nested classes defined in the high-level languages and observe this naming scheme.

  Substitutes the elements of an array of types for the type parameters of the current generic type definition and returns a object representing the resulting constructed type.

  A representing the constructed type formed by substituting the elements of for the type parameters of the current generic type.

  An array of types to be substituted for the type parameters of the current generic type.
- Method
  2.0.0.0
  4.0.0.0
  System.Type

  The method provides a way to generate pointer types for parameter lists.

  Using the syntax of Microsoft intermediate language (MSIL), if the current object represents , this method returns a object representing Int32*.

  Returns a object that represents a pointer to the current type.

  A object that represents a pointer to the current type.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberTypes To be added.

  This property overrides . Therefore, when you examine a set of objects—for example, the array returned by —the property returns when a given member is a nested type.

  If the current represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

  If the current represents a type parameter in the definition of a generic type or generic method, this property always returns .

  Gets a value indicating that this member is a type or a nested type.

- Field
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object null

  Use the Missing field for invocation through reflection to obtain the default value of a parameter. If the Missing field is passed in for a parameter value and there is no default value for that parameter, an is thrown.

  Represents a missing value in the information. This field is read-only.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.Module

  A that reflects the module in which the current is defined.

  If the current represents a constructed generic type, this property returns the module in which the generic type definition was defined. For example, if you create an instance of MyGenericStack<int>, the property for the constructed type returns the module in which MyGenericStack<T> is defined.

  Similarly, if the current represents a generic parameter , this property returns the assembly that contains the generic type that defines .

  Gets the module (the DLL) in which the current is defined.

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the namespace of the current .

  A namespace is a logical design-time naming convenience, used mainly to define scope in an application and organize classes and other types in a single hierarchical structure. From the viewpoint of the runtime, there are no namespaces.

  If the current represents a constructed generic type, this property returns the namespace that contains the generic type definition. Similarly, if the current represents a generic parameter , this property returns the namespace that contains the generic type definition that defines .

  If the current object represents a generic parameter, this property returns null.

  Gets the namespace of the .

  1
  Reflection
- Method
  4.0.0.0
  System.Boolean `` `` To be added.

  Indicates whether two objects are equal.

  true if is equal to ; otherwise, false.

  The first object to compare. The second object to compare.
- Method
  4.0.0.0
  System.Boolean `` `` To be added.

  Indicates whether two objects are not equal.

  true if is not equal to ; otherwise, false.

  The first object to compare. The second object to compare.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type

  The object through which the current instance was obtained.

  The following example demonstrates the property. Although the method is declared in , its reflected type is obtained from .

  `using System; using System.Reflection; public abstract class ReflectedTypeTest { public abstract class MyClassA { public abstract int m(); } public abstract class MyClassB : MyClassA { } public static void Main(string[] args) { Console.WriteLine("Reflected type of m is {0}", typeof(MyClassB).GetMethod("m").ReflectedType); } }`

  The output is

  Reflected type of m is ReflectedTypeTest+MyClassB

  For objects, the value of this property is always the same as the value of the property.

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

  1
  Reflection
- Method
  2.0.0.0
  4.0.0.0
  System.Type `` `` ``

  If the assembly containing the type is not already loaded into the reflection-only context, using the method is equivalent to first loading the assembly for reflection only, using the method, and then loading the type by calling the assembly's method. For information about assembly-qualified names, see the property. For additional details on specifying type names, see the method overload.

  If the assembly is already loaded for execution, another copy is loaded into the reflection-only context.

  The parameter specifies what happens when the type is not found, and also suppresses certain other exception conditions, as described in the Exceptions section. Some exceptions are thrown regardless of the value of . For example, if the assembly is not valid, a is thrown even if is false.

  For more information about using the reflection-only context, see How to: Load Assemblies into the Reflection-Only Context.

  Gets the with the specified name, specifying whether to perform a case-sensitive search and whether to throw an exception if the type is not found. The type is loaded for reflection only, not for execution.

  The type with the specified name, if found; otherwise, null. If the type is not found, the parameter specifies whether null is returned or an exception is thrown. In some cases, an exception is thrown regardless of the value of . See the Exceptions section.

  The assembly-qualified name of the to get. true to throw a if the type cannot be found; false to return null if the type cannot be found. Specifying false also suppresses some other exception conditions, but not all of them. See the Exceptions section. true to perform a case-insensitive search for ; false to perform a case-sensitive search for .
- Property
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.StructLayoutAttribute To be added.

  is not returned by the method. Instead, use this property to get it.

  Gets a that describes the layout of the current type.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` ``

  This method is for access to managed classes from unmanaged code, and should not be called from managed code. For more information about IDispatch::GetTypeInfo, see the MSDN Library.

  Retrieves the type information for an object, which can then be used to get the type information for an interface.

  The type information to return. The locale identifier for the type information. A pointer to the requested type information object.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  This method returns the fully qualified common language runtime namespace and name for all primitive types. For example, the C# instruction, (long)0.Type().ToString() returns "System.Int64" instead of merely "Int64".

  If the current represents a generic type, the type and its type arguments are qualified by namespace and by nested type, but not by assembly. If the current represents a type parameter in the definition of a generic type or generic method, this method returns the unqualified name of the type parameter.

  Returns a String representing the name of the current Type.

  A representing the name of the current .

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.RuntimeTypeHandle

  The for the current .

  TypeHandle encapsulates a pointer to an internal data structure that represents the type. This handle is unique during the process lifetime. The handle is valid only in the application domain in which it was obtained.

  Gets the handle for the current .

  1
  RuntimeInfrastructure
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
  System.Reflection.ConstructorInfo

  A containing the name of the static constructor for the type represented by the current instance

  Class initializers are also available through the method, or through overloads of the , , , and methods that take as a parameter.

  If the current represents a type parameter in the definition of a generic type or generic method, this property returns null.

  Gets the initializer for the .

  1
  Reflection
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type

  The underlying system type for the .

  This property is read-only.

  As described above.

  Indicates the type provided by the common language runtime that represents this type.

  1
  Reflection
0