Type Type Type Type Class

Definition

表示类型声明:类类型、接口类型、数组类型、值类型、枚举类型、类型参数、泛型类型定义,以及开放或封闭构造的泛型类型。 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.

public ref class Type abstract : System::Reflection::MemberInfo, System::Reflection::IReflect, System::Runtime::InteropServices::_Type
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
public abstract class Type : System.Reflection.MemberInfo, System.Reflection.IReflect, System.Runtime.InteropServices._Type
type Type = class
    inherit MemberInfo
    interface _Type
    interface IReflect
Public MustInherit Class Type
Inherits MemberInfo
Implements _Type, IReflect
Inheritance
Derived
Attributes
Implements

Examples

下面的示例显示了一些具有代表性的功能的TypeThe following example shows a few representative features of Type. C#typeof运算符 (GetType在 Visual Basic 中的运算符typeidVisual c + + 中的运算符) 用于获取Type对象,表示StringThe C# typeof operator (GetType operator in Visual Basic, typeid operator in Visual C++) is used to get a Type object representing String. 从此Type对象,GetMethod方法用于获取MethodInfo表示Substring重载的起始位置和长度。From this Type object, the GetMethod method is used to get a MethodInfo representing the Substring overload that takes a starting location and a length.

若要标识重载签名,该代码示例创建一个临时数组,包含两个Type对象表示int(Integer在 Visual Basic 中)。To identify the overload signature, the code example creates a temporary array containing two Type objects representing int (Integer in Visual Basic).

备注

若要确切地说,该数组包含两个引用的实例Type,它表示int当前应用程序域中。To be precise, the array contains two references to the instance of Type that represents int in the current application domain. 对于任何类型,是的一个实例Type每个应用程序域。For any type, there is only one instance of Type per application domain.

代码示例使用MethodInfo来调用Substring方法对字符串"Hello,World !",并显示结果。The code example uses the MethodInfo to invoke the Substring method on the string "Hello, World!", and displays the result.

#using <System.dll>

using namespace System;
using namespace System::Reflection;

void main()
{
    // Get a Type object representing the System.String type.
    Type^ t = String::typeid;

    MethodInfo^ substr = t->GetMethod("Substring", 
        gcnew array<Type^> { int::typeid, int::typeid });

    Object^ result = 
        substr->Invoke("Hello, World!", gcnew array<Object^> { 7, 5 });
    Console::WriteLine("{0} returned \"{1}\".", substr, result);
}

/* This code example produces the following output:

System.String Substring(Int32, Int32) returned "World".
 */
using System;
using System.Reflection;

class Example
{
    static void Main()
    {
        Type t = typeof(String);

        MethodInfo substr = t.GetMethod("Substring", 
            new Type[] { typeof(int), typeof(int) });

        Object result = 
            substr.Invoke("Hello, World!", new Object[] { 7, 5 });
        Console.WriteLine("{0} returned \"{1}\".", substr, result);
    }
}

/* This code example produces the following output:

System.String Substring(Int32, Int32) returned "World".
 */
Imports System
Imports System.Reflection

Module Example
    
    Sub Main() 

        Dim t As Type = GetType(String)
        
        Dim substr As MethodInfo = t.GetMethod("Substring", _
            New Type() { GetType(Integer), GetType(Integer) })
        
        Dim result As Object = _ 
            substr.Invoke("Hello, World!", New Object() { 7, 5 })
        Console.WriteLine("{0} returned ""{1}"".", substr, result)
    
    End Sub 
End Module

' This code example produces the following output:
'
'System.String Substring(Int32, Int32) returned "World".

Remarks

Type 是的根System.Reflection功能是主要的方法来访问元数据。Type is the root of the System.Reflection functionality and is the primary way to access metadata. 使用的成员Type以及模块和在其中部署此类的程序集获取类型声明,成员的类型 (如构造函数、 方法、 字段、 属性和事件的类),有关信息。Use the members of Type to get information about a type declaration, about the members of a type (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.

所需的代码使用反射来获取信息类型和成员,而不考虑其访问级别没有权限。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. 但是,为了使代码以使用反射来访问成员,通常情况下无法访问,例如私有或内部的方法,或受保护的字段类型的类不会继承,你的代码必须具有ReflectionPermissionHowever, 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 ReflectionPermission. 请参阅反射的安全注意事项See Security Considerations for Reflection.

Type 是允许多个实现的抽象基类。Type is an abstract base class that allows multiple implementations. 系统将始终提供派生的类RuntimeTypeThe system will always provide the derived class RuntimeType. 在反射中,从 word 的运行时的所有类都只都创建一次每个系统和支持的比较操作中的对象。In reflection, all classes beginning with the word Runtime are created only once per object in the system and support comparison operations.

备注

在多线程方案中,不要锁定Type为了同步访问对象static数据。In multithreading scenarios, do not lock Type 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. 相反,将对静态数据的访问同步通过锁定私有static对象。Instead, synchronize access to static data by locking a private static object.

备注

在派生的类可以访问受保护的成员调用代码的基类。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.

本节内容:In this section:

一个类型对象表示哪些类型? What types does a Type object represent?
检索类型对象 Retrieving a Type object
比较类型对象相等Comparing type objects for equality

一个类型对象表示哪些类型?What types does a Type object represent?

此类是线程安全;多个线程可以同时从这种类型的实例读取。This class is thread safe; multiple threads can concurrently read from an instance of this type. 实例Type类可以表示任何以下类型:An instance of the Type class can represent any of the following types:

  • Classes

  • 值类型Value types

  • 数组Arrays

  • 接口Interfaces

  • 枚举Enumerations

  • 委托Delegates

  • 构造的泛型类型和泛型类型定义Constructed generic types and generic type definitions

  • 类型实参和类型参数的构造的泛型类型、 泛型类型定义和泛型方法定义Type arguments and type parameters of constructed generic types, generic type definitions, and generic method definitions

检索类型对象Retrieving a Type object

Type可以按以下方式获取与特定类型关联的对象:The Type object associated with a particular type can be obtained in the following ways:

  • 实例Object.GetType方法将返回Type对象,表示实例的类型。The instance Object.GetType method returns a Type object that represents the type of an instance. 由于所有托管的类型派生Object,则GetType可以在任何类型的实例上调用方法。Because all managed types derive from Object, the GetType method can be called on an instance of any type.

    下面的示例调用Object.GetType方法,以确定一个对象数组中每个对象的运行时类型。The following example calls the Object.GetType method to determine the runtime type of each object in an object array.

    using namespace System;
    
    void main()
    {
       array<Object^>^ values = { "word", true, 120, 136.34 };
       for each (Object^ value in values)
          Console::WriteLine("{0} - type {1}", value, 
                            value->GetType()->Name);
    }
    // The example displays the following output:
    //       word - type String
    //       True - type Boolean
    //       120 - type Int32
    //       136.34 - type Double
    
    using System;
    
    public class Example
    {
       public static void Main()
       {
          object[] values = { "word", true, 120, 136.34, 'a' };
          foreach (var value in values)
             Console.WriteLine("{0} - type {1}", value, 
                               value.GetType().Name);
       }
    }
    // The example displays the following output:
    //       word - type String
    //       True - type Boolean
    //       120 - type Int32
    //       136.34 - type Double
    //       a - type Char
    
    Module Example
       Public Sub Main()
          Dim values() As Object = { "word", True, 120, 136.34, "a"c }
          For Each value In values
             Console.WriteLine("{0} - type {1}", value, 
                               value.GetType().Name)
          Next
       End Sub
    End Module
    ' The example displays the following output:
    '       word - type String
    '       True - type Boolean
    '       120 - type Int32
    '       136.34 - type Double
    '       a - type Char
    
  • 静态Type.GetType方法返回Type对象,表示由其完全限定名称指定的类型。The static Type.GetType methods return a Type object that represents a type specified by its fully qualified name.

  • Module.GetTypesModule.GetType,并Module.FindTypes方法返回Type代表模块中定义的类型的对象。The Module.GetTypes, Module.GetType, and Module.FindTypes methods return Type objects that represent the types defined in a module. 第一种方法可以用于获取一个数组Type模块中定义的所有公共和专用类型的对象。The first method can be used to obtain an array of Type objects for all the public and private types defined in a module. (你可以获取的实例Module通过Assembly.GetModuleAssembly.GetModules方法,或通过Type.Module属性。)(You can obtain an instance of Module through the Assembly.GetModule or Assembly.GetModules method, or through the Type.Module property.)

  • System.Reflection.Assembly对象包含的方法来检索中包括程序集定义的类数Assembly.GetTypeAssembly.GetTypes,和Assembly.GetExportedTypesThe System.Reflection.Assembly object contains a number of methods to retrieve the classes defined in an assembly, including Assembly.GetType, Assembly.GetTypes, and Assembly.GetExportedTypes.

  • FindInterfaces方法返回类型支持的接口类型的筛选的列表。The FindInterfaces method returns a filtered list of interface types supported by a type.

  • GetElementType方法将返回Type表示的元素的对象。The GetElementType method returns a Type object that represents the element.

  • GetInterfacesGetInterface方法返回Type表示支持一种类型的接口类型的对象。The GetInterfaces and GetInterface methods return Type objects representing the interface types supported by a type.

  • GetTypeArray方法返回的数组Type表示指定的一组任意对象类型的对象。The GetTypeArray method returns an array of Type objects representing the types specified by an arbitrary set of objects. 类型的数组与指定的对象ObjectThe objects are specified with an array of type Object.

  • GetTypeFromProgIDGetTypeFromCLSID方法提供的 COM 互操作性。The GetTypeFromProgID and GetTypeFromCLSID methods are provided for COM interoperability. 它们将返回Type对象,表示由指定的类型ProgIDCLSIDThey return a Type object that represents the type specified by a ProgID or CLSID.

  • GetTypeFromHandle方法提供的互操作性。The GetTypeFromHandle method is provided for interoperability. 它将返回Type对象,表示指定类句柄的类型。It returns a Type object that represents the type specified by a class handle.

  • C#typeof运算符,c + +typeid运算符和 Visual BasicGetType运算符获取Type类型对象。The C# typeof operator, the C++ typeid operator, and the Visual Basic GetType operator obtain the Type object for a type.

  • MakeGenericType方法将返回Type对象,表示构造泛型类型,这是开放式构造的类型,如果其ContainsGenericParameters属性返回true,和封闭式构造类型否则。The MakeGenericType method returns a Type object representing a constructed generic type, which is an open constructed type if its ContainsGenericParameters property returns true, and a closed constructed type otherwise. 可以实例化泛型类型,仅当已关闭。A generic type can be instantiated only if it is closed.

  • MakeArrayTypeMakePointerType,并MakeByRefType方法返回Type分别表示数组的指定的类型的指针、 指定的类型和引用参数的类型的对象 (ref C# 中ByRef在 Visual Basic 中)。The MakeArrayType, MakePointerType, and MakeByRefType methods return Type 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).

比较类型对象相等Comparing type objects for equality

一个Type,表示一种类型是唯一的对象; 即,两个Type对象引用是否引用同一对象当且仅当它们表示相同的类型。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. 这样的比较Type对象使用引用相等性。This allows for comparison of Type objects using reference equality. 下面的示例比较Type对象表示的整数值,以确定它们是否相同类型的数。The following example compares the Type objects that represent a number of integer values to determine whether they are of the same type.

using namespace System;

void main()
{
   Int64 number1 = 1635429;
   Int32 number2 = 16203;
   double number3 = 1639.41;
   Int64 number4 = 193685412;
   
   // Get the type of number1.
   Type^ t = number1.GetType();
   
   // Compare types of all objects with number1.
   Console::WriteLine("Type of number1 and number2 are equal: {0}",
                      Object::ReferenceEquals(t, number2.GetType()));
   Console::WriteLine("Type of number1 and number3 are equal: {0}",
                      Object::ReferenceEquals(t, number3.GetType()));
   Console::WriteLine("Type of number1 and number4 are equal: {0}",
                      Object::ReferenceEquals(t, number4.GetType()));
}
// The example displays the following output:
//       Type of number1 and number2 are equal: False
//       Type of number1 and number3 are equal: False
//       Type of number1 and number4 are equal: True
using System;

public class Example
{
   public static void Main()
   {
      long number1 = 1635429;
      int number2 = 16203;
      double number3 = 1639.41;
      long number4 = 193685412;
      
      // Get the type of number1.
      Type t = number1.GetType();
      
      // Compare types of all objects with number1.
      Console.WriteLine("Type of number1 and number2 are equal: {0}",
                        Object.ReferenceEquals(t, number2.GetType()));
      Console.WriteLine("Type of number1 and number3 are equal: {0}",
                        Object.ReferenceEquals(t, number3.GetType()));
      Console.WriteLine("Type of number1 and number4 are equal: {0}",
                        Object.ReferenceEquals(t, number4.GetType()));
   }
}
// The example displays the following output:
//       Type of number1 and number2 are equal: False
//       Type of number1 and number3 are equal: False
//       Type of number1 and number4 are equal: True
Module Example
   Public Sub Main()
      Dim number1 As Long = 1635429
      Dim number2 As Integer = 16203
      Dim number3 As Double = 1639.41
      Dim number4 As Long = 193685412
      
      ' Get the type of number1.
      Dim t As Type = number1.GetType()
      
      ' Compare types of all objects with number1.
      Console.WriteLine("Type of number1 and number2 are equal: {0}",
                        Object.ReferenceEquals(t, number2.GetType()))
      Console.WriteLine("Type of number1 and number3 are equal: {0}",
                        Object.ReferenceEquals(t, number3.GetType()))
      Console.WriteLine("Type of number1 and number4 are equal: {0}",
                        Object.ReferenceEquals(t, number4.GetType()))
   End Sub
End Module
' The example displays the following output:
'       Type of number1 and number2 are equal: False
'       Type of number1 and number3 are equal: False
'       Type of number1 and number4 are equal: True

Notes to Inheritors

继承自Type,必须重写以下成员: When you inherit from Type, you must override the following members:

Constructors

Type() Type() Type() Type()

初始化 Type 类的新实例。 Initializes a new instance of the Type class.

Fields

Delimiter Delimiter Delimiter Delimiter

分隔 Type 的命名空间中的名称。 Separates names in the namespace of the Type. 此字段为只读。 This field is read-only.

EmptyTypes EmptyTypes EmptyTypes EmptyTypes

表示 Type 类型的空数组。 Represents an empty array of type Type. 此字段为只读。 This field is read-only.

FilterAttribute FilterAttribute FilterAttribute FilterAttribute

表示用在特性上的成员筛选器。 Represents the member filter used on attributes. 此字段为只读。 This field is read-only.

FilterName FilterName FilterName FilterName

表示用于名称的区分大小写的成员筛选器。 Represents the case-sensitive member filter used on names. 此字段为只读。 This field is read-only.

FilterNameIgnoreCase FilterNameIgnoreCase FilterNameIgnoreCase FilterNameIgnoreCase

表示用于名称的不区分大小写的成员筛选器。 Represents the case-insensitive member filter used on names. 此字段为只读。 This field is read-only.

Missing Missing Missing Missing

表示 Type 信息中的缺少值。 Represents a missing value in the Type information. 此字段为只读。 This field is read-only.

Properties

Assembly Assembly Assembly Assembly

获取在其中声明该类型的 Assembly Gets the Assembly in which the type is declared. 对于泛型类型,则获取在其中定义该泛型类型的 Assembly For generic types, gets the Assembly in which the generic type is defined.

AssemblyQualifiedName AssemblyQualifiedName AssemblyQualifiedName AssemblyQualifiedName

获取类型的程序集限定名,其中包括从中加载 Type 的程序集的名称。 Gets the assembly-qualified name of the type, which includes the name of the assembly from which this Type object was loaded.

Attributes Attributes Attributes Attributes

获取与 Type 关联的属性。 Gets the attributes associated with the Type.

BaseType BaseType BaseType BaseType

获取当前 Type 直接从中继承的类型。 Gets the type from which the current Type directly inherits.

ContainsGenericParameters ContainsGenericParameters ContainsGenericParameters ContainsGenericParameters

获取一个值,该值指示当前 Type 对象是否具有尚未被特定类型替代的类型参数。 Gets a value indicating whether the current Type object has type parameters that have not been replaced by specific types.

CustomAttributes CustomAttributes CustomAttributes CustomAttributes

获取包含此成员自定义属性的集合。 Gets a collection that contains this member's custom attributes.

(Inherited from MemberInfo)
DeclaringMethod DeclaringMethod DeclaringMethod DeclaringMethod

获取一个表示声明方法的 MethodBase(如果当前 Type 表示泛型方法的一个类型参数)。 Gets a MethodBase that represents the declaring method, if the current Type represents a type parameter of a generic method.

DeclaringType DeclaringType DeclaringType DeclaringType

获取用来声明当前的嵌套类型或泛型类型参数的类型。 Gets the type that declares the current nested type or generic type parameter.

DefaultBinder DefaultBinder DefaultBinder DefaultBinder

获取默认联编程序的引用,该程序实现的内部规则用于选择由 InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) 调用的合适成员。 Gets a reference to the default binder, which implements internal rules for selecting the appropriate members to be called by InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]).

FullName FullName FullName FullName

获取该类型的完全限定名称,包括其命名空间,但不包括程序集。 Gets the fully qualified name of the type, including its namespace but not its assembly.

GenericParameterAttributes GenericParameterAttributes GenericParameterAttributes GenericParameterAttributes

获取描述当前泛型类型参数的协变和特殊约束的 GenericParameterAttributes 标志。 Gets a combination of GenericParameterAttributes flags that describe the covariance and special constraints of the current generic type parameter.

GenericParameterPosition GenericParameterPosition GenericParameterPosition GenericParameterPosition

Type 对象表示泛型类型或泛型方法的类型参数时,获取类型参数在声明它的泛型类型或方法的类型参数列表中的位置。 Gets the position of the type parameter in the type parameter list of the generic type or method that declared the parameter, when the Type object represents a type parameter of a generic type or a generic method.

GenericTypeArguments GenericTypeArguments GenericTypeArguments GenericTypeArguments

获取此类型泛型类型参数的数组。 Gets an array of the generic type arguments for this type.

GUID GUID GUID GUID

获取与 Type 关联的 GUID。 Gets the GUID associated with the Type.

HasElementType HasElementType HasElementType HasElementType

获取一个值,通过该值指示当前 Type 是包含还是引用另一类型,即当前 Type 是数组、指针还是通过引用传递。 Gets a value indicating whether the current Type encompasses or refers to another type; that is, whether the current Type is an array, a pointer, or is passed by reference.

IsAbstract IsAbstract IsAbstract IsAbstract

获取一个值,通过该值指示 Type 是否为抽象的并且必须被重写。 Gets a value indicating whether the Type is abstract and must be overridden.

IsAnsiClass IsAnsiClass IsAnsiClass IsAnsiClass

获取一个值,该值指示是否为 AnsiClass 选择了字符串格式属性 Type Gets a value indicating whether the string format attribute AnsiClass is selected for the Type.

IsArray IsArray IsArray IsArray

获取一个值,该值指示类型是否为数组。 Gets a value that indicates whether the type is an array.

IsAutoClass IsAutoClass IsAutoClass IsAutoClass

获取一个值,该值指示是否为 AutoClass 选择了字符串格式属性 Type Gets a value indicating whether the string format attribute AutoClass is selected for the Type.

IsAutoLayout IsAutoLayout IsAutoLayout IsAutoLayout

获取指示当前类型的字段是否由公共语言运行时自动放置的值。 Gets a value indicating whether the fields of the current type are laid out automatically by the common language runtime.

IsByRef IsByRef IsByRef IsByRef

获取一个值,该值指示 Type 是否由引用传递。 Gets a value indicating whether the Type is passed by reference.

IsByRefLike IsByRefLike IsByRefLike IsByRefLike
IsClass IsClass IsClass IsClass

获取一个值,通过该值指示 Type 是否是一个类或委托;即,不是值类型或接口。 Gets a value indicating whether the Type is a class or a delegate; that is, not a value type or interface.

IsCOMObject IsCOMObject IsCOMObject IsCOMObject

获取一个值,通过该值指示 Type 是否为 COM 对象。 Gets a value indicating whether the Type is a COM object.

IsConstructedGenericType IsConstructedGenericType IsConstructedGenericType IsConstructedGenericType

获取指示此对象是否表示构造的泛型类型的值。 Gets a value that indicates whether this object represents a constructed generic type. 你可以创建构造型泛型类型的实例。 You can create instances of a constructed generic type.

IsContextful IsContextful IsContextful IsContextful

获取一个值,通过该值指示 Type 在上下文中是否可以被承载。 Gets a value indicating whether the Type can be hosted in a context.

IsEnum IsEnum IsEnum IsEnum

获取一个值,该值指示当前的 Type 是否表示枚举。 Gets a value indicating whether the current Type represents an enumeration.

IsExplicitLayout IsExplicitLayout IsExplicitLayout IsExplicitLayout

获取指示当前类型的字段是否放置在显式指定的偏移量处的值。 Gets a value indicating whether the fields of the current type are laid out at explicitly specified offsets.

IsGenericMethodParameter IsGenericMethodParameter IsGenericMethodParameter IsGenericMethodParameter
IsGenericParameter IsGenericParameter IsGenericParameter IsGenericParameter

获取一个值,该值指示当前 Type 是否表示泛型类型或方法的定义中的类型参数。 Gets a value indicating whether the current Type represents a type parameter in the definition of a generic type or method.

IsGenericType IsGenericType IsGenericType IsGenericType

获取一个值,该值指示当前类型是否是泛型类型。 Gets a value indicating whether the current type is a generic type.

IsGenericTypeDefinition IsGenericTypeDefinition IsGenericTypeDefinition IsGenericTypeDefinition

获取一个值,该值指示当前 Type 是否表示可以用来构造其他泛型类型的泛型类型定义。 Gets a value indicating whether the current Type represents a generic type definition, from which other generic types can be constructed.

IsGenericTypeParameter IsGenericTypeParameter IsGenericTypeParameter IsGenericTypeParameter
IsImport IsImport IsImport IsImport

获取一个值,该值指示 Type 是否应用了 ComImportAttribute 属性,如果应用了该属性,则表示它是从 COM 类型库导入的。 Gets a value indicating whether the Type has a ComImportAttribute attribute applied, indicating that it was imported from a COM type library.

IsInterface IsInterface IsInterface IsInterface

获取一个值,通过该值指示 Type 是否是一个接口;即,不是类或值类型。 Gets a value indicating whether the Type is an interface; that is, not a class or a value type.

IsLayoutSequential IsLayoutSequential IsLayoutSequential IsLayoutSequential

获取指示当前类型的字段是否按顺序(定义顺序或发送到元数据的顺序)放置的值。 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.

IsMarshalByRef IsMarshalByRef IsMarshalByRef IsMarshalByRef

获取一个值,该值指示 Type 是否按引用进行封送。 Gets a value indicating whether the Type is marshaled by reference.

IsNested IsNested IsNested IsNested

获取一个指示当前 Type 对象是否表示其定义嵌套在另一个类型的定义之内的类型的值。 Gets a value indicating whether the current Type object represents a type whose definition is nested inside the definition of another type.

IsNestedAssembly IsNestedAssembly IsNestedAssembly IsNestedAssembly

获取一个值,通过该值指示 Type 是否是嵌套的并且只能在它自己的程序集内可见。 Gets a value indicating whether the Type is nested and visible only within its own assembly.

IsNestedFamANDAssem IsNestedFamANDAssem IsNestedFamANDAssem IsNestedFamANDAssem

获取一个值,通过该值指示 Type 是否是嵌套的并且只对同时属于自己家族和自己程序集的类可见。 Gets a value indicating whether the Type is nested and visible only to classes that belong to both its own family and its own assembly.

IsNestedFamily IsNestedFamily IsNestedFamily IsNestedFamily

获取一个值,通过该值指示 Type 是否是嵌套的并且只能在它自己的家族内可见。 Gets a value indicating whether the Type is nested and visible only within its own family.

IsNestedFamORAssem IsNestedFamORAssem IsNestedFamORAssem IsNestedFamORAssem

获取一个值,通过该值指示 Type 是否是嵌套的并且只对属于它自己的家族或属于它自己的程序集的类可见。 Gets a value indicating whether the Type is nested and visible only to classes that belong to either its own family or to its own assembly.

IsNestedPrivate IsNestedPrivate IsNestedPrivate IsNestedPrivate

获取一个值,通过该值指示 Type 是否是嵌套的并声明为私有。 Gets a value indicating whether the Type is nested and declared private.

IsNestedPublic IsNestedPublic IsNestedPublic IsNestedPublic

获取一个值,通过该值指示类是否是嵌套的并且声明为公共的。 Gets a value indicating whether a class is nested and declared public.

IsNotPublic IsNotPublic IsNotPublic IsNotPublic

获取一个值,该值指示 Type 是否声明为公共类型。 Gets a value indicating whether the Type is not declared public.

IsPointer IsPointer IsPointer IsPointer

获取一个值,通过该值指示 Type 是否为指针。 Gets a value indicating whether the Type is a pointer.

IsPrimitive IsPrimitive IsPrimitive IsPrimitive

获取一个值,通过该值指示 Type 是否为基元类型之一。 Gets a value indicating whether the Type is one of the primitive types.

IsPublic IsPublic IsPublic IsPublic

获取一个值,该值指示 Type 是否声明为公共类型。 Gets a value indicating whether the Type is declared public.

IsSealed IsSealed IsSealed IsSealed

获取一个值,该值指示 Type 是否声明为密封的。 Gets a value indicating whether the Type is declared sealed.

IsSecurityCritical IsSecurityCritical IsSecurityCritical IsSecurityCritical

获取一个值,该值指示当前的类型在当前信任级别上是安全关键的还是安全可靠关键的,并因此可以执行关键操作。 Gets a value that indicates whether the current type is security-critical or security-safe-critical at the current trust level, and therefore can perform critical operations.

IsSecuritySafeCritical IsSecuritySafeCritical IsSecuritySafeCritical IsSecuritySafeCritical

获取一个值,该值指示当前类型在当前信任级别上是否是安全可靠关键的;即它是否可以执行关键操作并可以由透明代码访问。 Gets a value that indicates whether the current type is security-safe-critical at the current trust level; that is, whether it can perform critical operations and can be accessed by transparent code.

IsSecurityTransparent IsSecurityTransparent IsSecurityTransparent IsSecurityTransparent

获取一个值,该值指示当前类型在当前信任级别上是否是透明的而无法执行关键操作。 Gets a value that indicates whether the current type is transparent at the current trust level, and therefore cannot perform critical operations.

IsSerializable IsSerializable IsSerializable IsSerializable

获取一个值,通过该值指示 Type 是否为可序列化的。 Gets a value indicating whether the Type is serializable.

IsSignatureType IsSignatureType IsSignatureType IsSignatureType
IsSpecialName IsSpecialName IsSpecialName IsSpecialName

获取一个值,该值指示该类型是否具有需要特殊处理的名称。 Gets a value indicating whether the type has a name that requires special handling.

IsSZArray IsSZArray IsSZArray IsSZArray
IsTypeDefinition IsTypeDefinition IsTypeDefinition IsTypeDefinition
IsUnicodeClass IsUnicodeClass IsUnicodeClass IsUnicodeClass

获取一个值,该值指示是否为 UnicodeClass 选择了字符串格式属性 Type Gets a value indicating whether the string format attribute UnicodeClass is selected for the Type.

IsValueType IsValueType IsValueType IsValueType

获取一个值,通过该值指示 Type 是否为值类型。 Gets a value indicating whether the Type is a value type.

IsVariableBoundArray IsVariableBoundArray IsVariableBoundArray IsVariableBoundArray
IsVisible IsVisible IsVisible IsVisible

获取一个指示 Type 是否可由程序集之外的代码访问的值。 Gets a value indicating whether the Type can be accessed by code outside the assembly.

MemberType MemberType MemberType MemberType

获取一个指示此成员是类型还是嵌套类型的 MemberTypes 值。 Gets a MemberTypes value indicating that this member is a type or a nested type.

MetadataToken MetadataToken MetadataToken MetadataToken

获取一个值,该值标识元数据元素。 Gets a value that identifies a metadata element.

(Inherited from MemberInfo)
Module Module Module Module

获取在其中定义当前 Type 的模块 (DLL)。 Gets the module (the DLL) in which the current Type is defined.

Name Name Name Name
Namespace Namespace Namespace Namespace

获取 Type 的命名空间。 Gets the namespace of the Type.

ReflectedType ReflectedType ReflectedType ReflectedType

获取用于获取该成员的类对象。 Gets the class object that was used to obtain this member.

StructLayoutAttribute StructLayoutAttribute StructLayoutAttribute StructLayoutAttribute

获取一个描述当前类型的布局的 StructLayoutAttribute Gets a StructLayoutAttribute that describes the layout of the current type.

TypeHandle TypeHandle TypeHandle TypeHandle

获取当前 Type 的句柄。 Gets the handle for the current Type.

TypeInitializer TypeInitializer TypeInitializer TypeInitializer

获取该类型的初始值设定项。 Gets the initializer for the type.

UnderlyingSystemType UnderlyingSystemType UnderlyingSystemType UnderlyingSystemType

指示表示该类型的公共语言运行时提供的类型。 Indicates the type provided by the common language runtime that represents this type.

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定当前 Type 的基础系统类型是否与指定 Object 的基础系统类型相同。 Determines if the underlying system type of the current Type object is the same as the underlying system type of the specified Object.

Equals(Type) Equals(Type) Equals(Type) Equals(Type)

确定当前 Type 的基础系统类型是否与指定 Type 的基础系统类型相同。 Determines if the underlying system type of the current Type is the same as the underlying system type of the specified Type.

FindInterfaces(TypeFilter, Object) FindInterfaces(TypeFilter, Object) FindInterfaces(TypeFilter, Object) FindInterfaces(TypeFilter, Object)

返回表示接口(由当前 Type 所实现或继承)的筛选列表的 Type 对象数组。 Returns an array of Type objects representing a filtered list of interfaces implemented or inherited by the current Type.

FindMembers(MemberTypes, BindingFlags, MemberFilter, Object) FindMembers(MemberTypes, BindingFlags, MemberFilter, Object) FindMembers(MemberTypes, BindingFlags, MemberFilter, Object) FindMembers(MemberTypes, BindingFlags, MemberFilter, Object)

返回指定成员类型的 MemberInfo 对象的筛选数组。 Returns a filtered array of MemberInfo objects of the specified member type.

GetArrayRank() GetArrayRank() GetArrayRank() GetArrayRank()

获取数组中的维数。 Gets the number of dimensions in an array.

GetAttributeFlagsImpl() GetAttributeFlagsImpl() GetAttributeFlagsImpl() GetAttributeFlagsImpl()

当在派生类中重写时,实现 Attributes 属性 (Property),并获取指示与 Type 关联的属性 (Attribute) 的位屏蔽。 When overridden in a derived class, implements the Attributes property and gets a bitmask indicating the attributes associated with the Type.

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

用指定绑定约束和指定调用约定,搜索其参数与指定自变量类型及修饰符匹配的构造函数。 Searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

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

使用指定绑定约束搜索其参数与指定自变量类型和修饰符匹配的构造函数。 Searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetConstructor(Type[]) GetConstructor(Type[]) GetConstructor(Type[]) GetConstructor(Type[])

搜索其参数与指定数组中的类型匹配的公共实例构造函数。 Searches for a public instance constructor whose parameters match the types in the specified array.

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

当在派生类中重写时,使用指定的绑定约束和指定的调用约定搜索其参数与指定的自变量类型和修饰符匹配的构造函数。 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.

GetConstructors() GetConstructors() GetConstructors() GetConstructors()

返回为当前 Type 定义的所有公共构造函数。 Returns all the public constructors defined for the current Type.

GetConstructors(BindingFlags) GetConstructors(BindingFlags) GetConstructors(BindingFlags) GetConstructors(BindingFlags)

当在派生类中重写时,使用指定 Type 搜索为当前 BindingFlags 定义的构造函数。 When overridden in a derived class, searches for the constructors defined for the current Type, using the specified BindingFlags.

GetCustomAttributes(Boolean) GetCustomAttributes(Boolean) GetCustomAttributes(Boolean) GetCustomAttributes(Boolean)

在派生类中重写时,返回应用于此成员的所有自定义属性的数组。 When overridden in a derived class, returns an array of all custom attributes applied to this member.

(Inherited from MemberInfo)
GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean)

在派生类中重写时,返回应用于此成员并由 Type 标识的自定义属性的数组。 When overridden in a derived class, returns an array of custom attributes applied to this member and identified by Type.

(Inherited from MemberInfo)
GetCustomAttributesData() GetCustomAttributesData() GetCustomAttributesData() GetCustomAttributesData()

返回 CustomAttributeData 对象列表,这些对象表示已应用到目标成员的特性相关数据。 Returns a list of CustomAttributeData objects representing data about the attributes that have been applied to the target member.

(Inherited from MemberInfo)
GetDefaultMembers() GetDefaultMembers() GetDefaultMembers() GetDefaultMembers()

搜索为设置了 Type 的当前 DefaultMemberAttribute 定义的成员。 Searches for the members defined for the current Type whose DefaultMemberAttribute is set.

GetElementType() GetElementType() GetElementType() GetElementType()

当在派生类中重写时,返回当前数组、指针或引用类型包含的或引用的对象的 Type When overridden in a derived class, returns the Type of the object encompassed or referred to by the current array, pointer or reference type.

GetEnumName(Object) GetEnumName(Object) GetEnumName(Object) GetEnumName(Object)

返回当前枚举类型中具有指定值的常数的名称。 Returns the name of the constant that has the specified value, for the current enumeration type.

GetEnumNames() GetEnumNames() GetEnumNames() GetEnumNames()

返回当前枚举类型中各个成员的名称。 Returns the names of the members of the current enumeration type.

GetEnumUnderlyingType() GetEnumUnderlyingType() GetEnumUnderlyingType() GetEnumUnderlyingType()

返回当前枚举类型的基础类型。 Returns the underlying type of the current enumeration type.

GetEnumValues() GetEnumValues() GetEnumValues() GetEnumValues()

返回当前枚举类型中各个常数的值组成的数组。 Returns an array of the values of the constants in the current enumeration type.

GetEvent(String) GetEvent(String) GetEvent(String) GetEvent(String)

返回表示指定的公共事件的 EventInfo 对象。 Returns the EventInfo object representing the specified public event.

GetEvent(String, BindingFlags) GetEvent(String, BindingFlags) GetEvent(String, BindingFlags) GetEvent(String, BindingFlags)

当在派生类中重写时,使用指定绑定约束,返回表示指定事件的 EventInfo 对象。 When overridden in a derived class, returns the EventInfo object representing the specified event, using the specified binding constraints.

GetEvents() GetEvents() GetEvents() GetEvents()

返回由当前 Type 声明或继承的所有公共事件。 Returns all the public events that are declared or inherited by the current Type.

GetEvents(BindingFlags) GetEvents(BindingFlags) GetEvents(BindingFlags) GetEvents(BindingFlags)

当在派生类中重写时,使用指定绑定约束,搜索由当前 Type 声明或继承的事件。 When overridden in a derived class, searches for events that are declared or inherited by the current Type, using the specified binding constraints.

GetField(String) GetField(String) GetField(String) GetField(String)

搜索具有指定名称的公共字段。 Searches for the public field with the specified name.

GetField(String, BindingFlags) GetField(String, BindingFlags) GetField(String, BindingFlags) GetField(String, BindingFlags)

使用指定绑定约束搜索指定字段。 Searches for the specified field, using the specified binding constraints.

GetFields() GetFields() GetFields() GetFields()

返回当前 Type 的所有公共字段。 Returns all the public fields of the current Type.

GetFields(BindingFlags) GetFields(BindingFlags) GetFields(BindingFlags) GetFields(BindingFlags)

当在派生类中重写时,使用指定绑定约束,搜索为当前 Type 定义的字段。 When overridden in a derived class, searches for the fields defined for the current Type, using the specified binding constraints.

GetGenericArguments() GetGenericArguments() GetGenericArguments() GetGenericArguments()

返回表示封闭式泛型类型的类型参数或泛型类型定义的类型参数的 Type 对象的数组。 Returns an array of Type objects that represent the type arguments of a closed generic type or the type parameters of a generic type definition.

GetGenericParameterConstraints() GetGenericParameterConstraints() GetGenericParameterConstraints() GetGenericParameterConstraints()

返回表示当前泛型类型参数约束的 Type 对象的数组。 Returns an array of Type objects that represent the constraints on the current generic type parameter.

GetGenericTypeDefinition() GetGenericTypeDefinition() GetGenericTypeDefinition() GetGenericTypeDefinition()

返回一个表示可用于构造当前泛型类型的泛型类型定义的 Type 对象。 Returns a Type object that represents a generic type definition from which the current generic type can be constructed.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

返回此实例的哈希代码。 Returns the hash code for this instance.

GetInterface(String) GetInterface(String) GetInterface(String) GetInterface(String)

搜索具有指定名称的接口。 Searches for the interface with the specified name.

GetInterface(String, Boolean) GetInterface(String, Boolean) GetInterface(String, Boolean) GetInterface(String, Boolean)

当在派生类中重写时,搜索指定的接口,指定是否要对接口名称执行不区分大小写的搜索。 When overridden in a derived class, searches for the specified interface, specifying whether to do a case-insensitive search for the interface name.

GetInterfaceMap(Type) GetInterfaceMap(Type) GetInterfaceMap(Type) GetInterfaceMap(Type)

返回指定接口类型的接口映射。 Returns an interface mapping for the specified interface type.

GetInterfaces() GetInterfaces() GetInterfaces() GetInterfaces()

当在派生类中重写时,获取由当前 Type 实现或继承的所有接口。 When overridden in a derived class, gets all the interfaces implemented or inherited by the current Type.

GetMember(String) GetMember(String) GetMember(String) GetMember(String)

搜索具有指定名称的公共成员。 Searches for the public members with the specified name.

GetMember(String, BindingFlags) GetMember(String, BindingFlags) GetMember(String, BindingFlags) GetMember(String, BindingFlags)

使用指定绑定约束搜索指定成员。 Searches for the specified members, using the specified binding constraints.

GetMember(String, MemberTypes, BindingFlags) GetMember(String, MemberTypes, BindingFlags) GetMember(String, MemberTypes, BindingFlags) GetMember(String, MemberTypes, BindingFlags)

使用指定绑定约束搜索指定成员类型的指定成员。 Searches for the specified members of the specified member type, using the specified binding constraints.

GetMembers() GetMembers() GetMembers() GetMembers()

返回为当前 Type 的所有公共成员。 Returns all the public members of the current Type.

GetMembers(BindingFlags) GetMembers(BindingFlags) GetMembers(BindingFlags) GetMembers(BindingFlags)

当在派生类中重写时,使用指定绑定约束,搜索为当前 Type 定义的成员。 When overridden in a derived class, searches for the members defined for the current Type, using the specified binding constraints.

GetMethod(String) GetMethod(String) GetMethod(String) GetMethod(String)

搜索具有指定名称的公共方法。 Searches for the public method with the specified name.

GetMethod(String, BindingFlags) GetMethod(String, BindingFlags) GetMethod(String, BindingFlags) GetMethod(String, BindingFlags)

使用指定绑定约束搜索指定方法。 Searches for the specified method, using the specified binding constraints.

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

用指定的绑定约束和指定的调用约定,搜索参数与指定的自变量类型及修饰符相匹配的指定方法。 Searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

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

使用指定绑定约束,搜索其参数与指定自变量类型及修饰符匹配的指定方法。 Searches for the specified method whose parameters match the specified argument types and modifiers, using the specified binding constraints.

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

搜索其参数与指定参数类型匹配的指定公共方法。 Searches for the specified public method whose parameters match the specified argument types.

GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[]) GetMethod(String, Type[], ParameterModifier[])

搜索其参数与指定自变量类型及修饰符匹配的指定公共方法。 Searches for the specified public method whose parameters match the specified argument types and modifiers.

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

当在派生类中重写时,使用指定的绑定约束和指定的调用约定搜索其参数与指定的自变量类型和修饰符匹配的指定方法。 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.

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

返回为当前 Type 的所有公共方法。 Returns all the public methods of the current Type.

GetMethods(BindingFlags) GetMethods(BindingFlags) GetMethods(BindingFlags) GetMethods(BindingFlags)

当在派生类中重写时,使用指定绑定约束,搜索为当前 Type 定义的方法。 When overridden in a derived class, searches for the methods defined for the current Type, using the specified binding constraints.

GetNestedType(String) GetNestedType(String) GetNestedType(String) GetNestedType(String)

搜索具有指定名称的公共嵌套类型。 Searches for the public nested type with the specified name.

GetNestedType(String, BindingFlags) GetNestedType(String, BindingFlags) GetNestedType(String, BindingFlags) GetNestedType(String, BindingFlags)

当在派生类中重写时,使用指定绑定约束搜索指定嵌套类型。 When overridden in a derived class, searches for the specified nested type, using the specified binding constraints.

GetNestedTypes() GetNestedTypes() GetNestedTypes() GetNestedTypes()

返回嵌套在当前的 Type 中的公共类型。 Returns the public types nested in the current Type.

GetNestedTypes(BindingFlags) GetNestedTypes(BindingFlags) GetNestedTypes(BindingFlags) GetNestedTypes(BindingFlags)

当在派生类中重写时,使用指定绑定约束搜索嵌套在当前 Type 中的类型。 When overridden in a derived class, searches for the types nested in the current Type, using the specified binding constraints.

GetProperties() GetProperties() GetProperties() GetProperties()

返回为当前 Type 的所有公共属性。 Returns all the public properties of the current Type.

GetProperties(BindingFlags) GetProperties(BindingFlags) GetProperties(BindingFlags) GetProperties(BindingFlags)

当在派生类中重写时,使用指定绑定约束,搜索当前 Type 的属性。 When overridden in a derived class, searches for the properties of the current Type, using the specified binding constraints.

GetProperty(String) GetProperty(String) GetProperty(String) GetProperty(String)

搜索具有指定名称的公共属性。 Searches for the public property with the specified name.

GetProperty(String, BindingFlags) GetProperty(String, BindingFlags) GetProperty(String, BindingFlags) GetProperty(String, BindingFlags)

使用指定的绑定约束搜索指定属性。 Searches for the specified property, using the specified binding constraints.

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

使用指定的绑定约束,搜索参数与指定的自变量类型及修饰符匹配的指定属性。 Searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetProperty(String, Type) GetProperty(String, Type) GetProperty(String, Type) GetProperty(String, Type)

搜索具有指定名称和返回类型的公共属性。 Searches for the public property with the specified name and return type.

GetProperty(String, Type, Type[]) GetProperty(String, Type, Type[]) GetProperty(String, Type, Type[]) GetProperty(String, Type, Type[])

搜索其参数与指定自变量类型匹配的指定公共属性。 Searches for the specified public property whose parameters match the specified argument types.

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

搜索其参数与指定自变量类型及修饰符匹配的指定公共属性。 Searches for the specified public property whose parameters match the specified argument types and modifiers.

GetProperty(String, Type[]) GetProperty(String, Type[]) GetProperty(String, Type[]) GetProperty(String, Type[])

搜索其参数与指定自变量类型匹配的指定公共属性。 Searches for the specified public property whose parameters match the specified argument types.

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

当在派生类中重写时,使用指定的绑定约束搜索其参数与指定的自变量类型和修饰符匹配的指定属性。 When overridden in a derived class, searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetType() GetType() GetType() GetType()

获取当前 Type Gets the current Type.

GetType(String) GetType(String) GetType(String) GetType(String)

获取具有指定名称的 Type,执行区分大小写的搜索。 Gets the Type with the specified name, performing a case-sensitive search.

GetType(String, Boolean) GetType(String, Boolean) GetType(String, Boolean) GetType(String, Boolean)

获取具有指定名称的 Type,指定是否执行区分大小写的搜索,以及在找不到类型时是否引发异常。 Gets the Type with the specified name, performing a case-sensitive search and specifying whether to throw an exception if the type is not found.

GetType(String, Boolean, Boolean) GetType(String, Boolean, Boolean) GetType(String, Boolean, Boolean) GetType(String, Boolean, Boolean)

获取具有指定名称的 Type,指定是否执行区分大小写的搜索,以及在找不到类型时是否引发异常。 Gets the Type with the specified name, specifying whether to throw an exception if the type is not found and whether to perform a case-sensitive search.

GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>) GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>) GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>) GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>)

获取具有指定名称的类型,(可选)提供自定义方法以解析程序集和该类型。 Gets the type with the specified name, optionally providing custom methods to resolve the assembly and the type.

GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>, Boolean) GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>, Boolean) GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>, Boolean) GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>, Boolean)

获取具有指定名称的类型,指定在找不到该类型时是否引发异常,(可选)提供自定义方法以解析程序集和该类型。 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.

GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>, Boolean, Boolean) GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>, Boolean, Boolean) GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>, Boolean, Boolean) GetType(String, Func<AssemblyName,Assembly>, Func<Assembly,String,Boolean,Type>, Boolean, Boolean)

获取具有指定名称的类型,指定是否执行区分大小写的搜索,在找不到类型时是否引发异常,(可选)提供自定义方法以解析程序集和该类型。 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.

GetTypeArray(Object[]) GetTypeArray(Object[]) GetTypeArray(Object[]) GetTypeArray(Object[])

获取指定数组中对象的类型。 Gets the types of the objects in the specified array.

GetTypeCode(Type) GetTypeCode(Type) GetTypeCode(Type) GetTypeCode(Type)

获取指定 Type 的基础类型代码。 Gets the underlying type code of the specified Type.

GetTypeCodeImpl() GetTypeCodeImpl() GetTypeCodeImpl() GetTypeCodeImpl()

返回此 Type 实例的基础类型代码。 Returns the underlying type code of this Type instance.

GetTypeFromCLSID(Guid) GetTypeFromCLSID(Guid) GetTypeFromCLSID(Guid) GetTypeFromCLSID(Guid)

获取与指定类标识符 (CLSID) 关联的类型。 Gets the type associated with the specified class identifier (CLSID).

GetTypeFromCLSID(Guid, Boolean) GetTypeFromCLSID(Guid, Boolean) GetTypeFromCLSID(Guid, Boolean) GetTypeFromCLSID(Guid, Boolean)

获取与指定类标识符 (CLSID) 关联的类型,指定在加载该类型时如果发生错误是否引发异常。 Gets the type associated with the specified class identifier (CLSID), specifying whether to throw an exception if an error occurs while loading the type.

GetTypeFromCLSID(Guid, String) GetTypeFromCLSID(Guid, String) GetTypeFromCLSID(Guid, String) GetTypeFromCLSID(Guid, String)

从指定服务器获取与指定类标识符 (CLSID) 关联的类型。 Gets the type associated with the specified class identifier (CLSID) from the specified server.

GetTypeFromCLSID(Guid, String, Boolean) GetTypeFromCLSID(Guid, String, Boolean) GetTypeFromCLSID(Guid, String, Boolean) GetTypeFromCLSID(Guid, String, Boolean)

从指定服务器获取与指定类标识符 (CLSID) 关联的类型,指定在加载该类型时如果发生错误是否引发异常。 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.

GetTypeFromHandle(RuntimeTypeHandle) GetTypeFromHandle(RuntimeTypeHandle) GetTypeFromHandle(RuntimeTypeHandle) GetTypeFromHandle(RuntimeTypeHandle)

获取由指定类型句柄引用的类型。 Gets the type referenced by the specified type handle.

GetTypeFromProgID(String) GetTypeFromProgID(String) GetTypeFromProgID(String) GetTypeFromProgID(String)

获取与指定程序标识符 (ProgID) 关联的类型,如果在加载 Type 时遇到错误,则返回空值。 Gets the type associated with the specified program identifier (ProgID), returning null if an error is encountered while loading the Type.

GetTypeFromProgID(String, Boolean) GetTypeFromProgID(String, Boolean) GetTypeFromProgID(String, Boolean) GetTypeFromProgID(String, Boolean)

获取与指定程序标识符 (ProgID) 关联的类型,指定如果在加载该类型时发生错误是否引发异常。 Gets the type associated with the specified program identifier (ProgID), specifying whether to throw an exception if an error occurs while loading the type.

GetTypeFromProgID(String, String) GetTypeFromProgID(String, String) GetTypeFromProgID(String, String) GetTypeFromProgID(String, String)

从指定服务器获取与指定程序标识符 (progID) 关联的类型,如果在加载该类型时遇到错误则返回空值。 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.

GetTypeFromProgID(String, String, Boolean) GetTypeFromProgID(String, String, Boolean) GetTypeFromProgID(String, String, Boolean) GetTypeFromProgID(String, String, Boolean)

从指定服务器获取与指定程序标识符 (progID) 关联的类型,指定如果在加载该类型时发生错误是否引发异常。 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.

GetTypeHandle(Object) GetTypeHandle(Object) GetTypeHandle(Object) GetTypeHandle(Object)

获取指定对象的 Type 的句柄。 Gets the handle for the Type of a specified object.

HasElementTypeImpl() HasElementTypeImpl() HasElementTypeImpl() HasElementTypeImpl()

当在派生类中重写时,实现 HasElementType 属性,确定当前 Type 是否包含另一类型或对其引用;即,当前 Type 是否是数组、指针或由引用传递。 When overridden in a derived class, implements the HasElementType property and determines whether the current Type encompasses or refers to another type; that is, whether the current Type is an array, a pointer, or is passed by reference.

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

使用指定的绑定约束并匹配指定的自变量列表,调用指定成员。 Invokes the specified member, using the specified binding constraints and matching the specified argument list.

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

使用指定的绑定约束和匹配的指定参数列表及区域性来调用指定成员。 Invokes the specified member, using the specified binding constraints and matching the specified argument list and culture.

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

当在派生类中重写时,使用指定的绑定约束并匹配指定的参数列表、修饰符和区域性,调用指定成员。 When overridden in a derived class, invokes the specified member, using the specified binding constraints and matching the specified argument list, modifiers and culture.

IsArrayImpl() IsArrayImpl() IsArrayImpl() IsArrayImpl()

在派生类中重写时,实现 IsArray 属性并确定 Type 是否为数组。 When overridden in a derived class, implements the IsArray property and determines whether the Type is an array.

IsAssignableFrom(Type) IsAssignableFrom(Type) IsAssignableFrom(Type) IsAssignableFrom(Type)

确定指定类型的实例是否能分配给当前类型实例。 Determines whether an instance of a specified type can be assigned to an instance of the current type.

IsByRefImpl() IsByRefImpl() IsByRefImpl() IsByRefImpl()

在派生类中重写时,实现 IsByRef 属性并确定Type 是否通过引用传递。 When overridden in a derived class, implements the IsByRef property and determines whether the Type is passed by reference.

IsCOMObjectImpl() IsCOMObjectImpl() IsCOMObjectImpl() IsCOMObjectImpl()

当在派生类中重写时,实现 IsCOMObject 属性并确定 Type 是否为 COM 对象。 When overridden in a derived class, implements the IsCOMObject property and determines whether the Type is a COM object.

IsContextfulImpl() IsContextfulImpl() IsContextfulImpl() IsContextfulImpl()

实现 IsContextful 属性并确定 Type 在上下文中是否可以被承载。 Implements the IsContextful property and determines whether the Type can be hosted in a context.

IsDefined(Type, Boolean) IsDefined(Type, Boolean) IsDefined(Type, Boolean) IsDefined(Type, Boolean)

在派生类中重写时,指示是否将指定类型或其派生类型的一个或多个特性应用于此成员。 When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member.

(Inherited from MemberInfo)
IsEnumDefined(Object) IsEnumDefined(Object) IsEnumDefined(Object) IsEnumDefined(Object)

返回一个值,该值指示当前的枚举类型中是否存在指定的值。 Returns a value that indicates whether the specified value exists in the current enumeration type.

IsEquivalentTo(Type) IsEquivalentTo(Type) IsEquivalentTo(Type) IsEquivalentTo(Type)

确定两个 COM 类型是否具有相同的标识,以及是否符合类型等效的条件。 Determines whether two COM types have the same identity and are eligible for type equivalence.

IsInstanceOfType(Object) IsInstanceOfType(Object) IsInstanceOfType(Object) IsInstanceOfType(Object)

确定指定的对象是否是当前 Type 的实例。 Determines whether the specified object is an instance of the current Type.

IsMarshalByRefImpl() IsMarshalByRefImpl() IsMarshalByRefImpl() IsMarshalByRefImpl()

实现 IsMarshalByRef 属性并确定 Type 是否按引用来进行封送。 Implements the IsMarshalByRef property and determines whether the Type is marshaled by reference.

IsPointerImpl() IsPointerImpl() IsPointerImpl() IsPointerImpl()

在派生类中重写时,实现 IsPointer 属性并确定 Type 是否为指针。 When overridden in a derived class, implements the IsPointer property and determines whether the Type is a pointer.

IsPrimitiveImpl() IsPrimitiveImpl() IsPrimitiveImpl() IsPrimitiveImpl()

在派生类中重写时,实现 IsPrimitive 属性并确定 Type 是否为基元类型之一。 When overridden in a derived class, implements the IsPrimitive property and determines whether the Type is one of the primitive types.

IsSubclassOf(Type) IsSubclassOf(Type) IsSubclassOf(Type) IsSubclassOf(Type)

确定当前 Type 是否派生自指定的 Type Determines whether the current Type derives from the specified Type.

IsValueTypeImpl() IsValueTypeImpl() IsValueTypeImpl() IsValueTypeImpl()

实现 IsValueType 属性并确定 Type 是否是值类型;即,它不是值类或接口。 Implements the IsValueType property and determines whether the Type is a value type; that is, not a class or an interface.

MakeArrayType() MakeArrayType() MakeArrayType() MakeArrayType()

返回 Type 对象,该对象表示当前类型的一维数组(下限为零)。 Returns a Type object representing a one-dimensional array of the current type, with a lower bound of zero.

MakeArrayType(Int32) MakeArrayType(Int32) MakeArrayType(Int32) MakeArrayType(Int32)

返回 Type 对象,该对象表示一个具有指定维数的当前类型的数组。 Returns a Type object representing an array of the current type, with the specified number of dimensions.

MakeByRefType() MakeByRefType() MakeByRefType() MakeByRefType()

返回表示作为 Type 参数(在 Visual Basic 中为 ref 参数)传递时的当前类型的 ByRef 对象。 Returns a Type object that represents the current type when passed as a ref parameter (ByRef parameter in Visual Basic).

MakeGenericMethodParameter(Int32) MakeGenericMethodParameter(Int32) MakeGenericMethodParameter(Int32) MakeGenericMethodParameter(Int32)
MakeGenericType(Type[]) MakeGenericType(Type[]) MakeGenericType(Type[]) MakeGenericType(Type[])

替代由当前泛型类型定义的类型参数组成的类型数组的元素,并返回表示结果构造类型的 Type 对象。 Substitutes the elements of an array of types for the type parameters of the current generic type definition and returns a Type object representing the resulting constructed type.

MakePointerType() MakePointerType() MakePointerType() MakePointerType()

返回表示指向当前类型的指针的 Type 对象。 Returns a Type object that represents a pointer to the current type.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。 Creates a shallow copy of the current Object.

(Inherited from Object)
ReflectionOnlyGetType(String, Boolean, Boolean) ReflectionOnlyGetType(String, Boolean, Boolean) ReflectionOnlyGetType(String, Boolean, Boolean) ReflectionOnlyGetType(String, Boolean, Boolean)

获取具有指定名称的 Type,指定是否执行区分大小写的搜索,以及在找不到类型时是否引发异常。 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. 该类型只为反射加载,而不为执行加载。 The type is loaded for reflection only, not for execution.

ToString() ToString() ToString() ToString()

返回表示当前 String 的名称的 Type Returns a String representing the name of the current Type.

Operators

Equality(Type, Type) Equality(Type, Type) Equality(Type, Type) Equality(Type, Type)

指示两个 Type 对象是否相等。 Indicates whether two Type objects are equal.

Inequality(Type, Type) Inequality(Type, Type) Inequality(Type, Type) Inequality(Type, Type)

指示两个 Type 对象是否不相等。 Indicates whether two Type objects are not equal.

Explicit Interface Implementations

ICustomAttributeProvider.GetCustomAttributes(Boolean) ICustomAttributeProvider.GetCustomAttributes(Boolean) ICustomAttributeProvider.GetCustomAttributes(Boolean) ICustomAttributeProvider.GetCustomAttributes(Boolean) Inherited from MemberInfo
ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) Inherited from MemberInfo
ICustomAttributeProvider.IsDefined(Type, Boolean) ICustomAttributeProvider.IsDefined(Type, Boolean) ICustomAttributeProvider.IsDefined(Type, Boolean) ICustomAttributeProvider.IsDefined(Type, Boolean) Inherited from MemberInfo
_MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。 Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from MemberInfo)
_MemberInfo.GetType() _MemberInfo.GetType() _MemberInfo.GetType() _MemberInfo.GetType()

获取一个表示 MemberInfo 类的 Type 对象。 Gets a Type object representing the MemberInfo class.

(Inherited from MemberInfo)
_MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr) _MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。 Retrieves the type information for an object, which can then be used to get the type information for an interface.

(Inherited from MemberInfo)
_MemberInfo.GetTypeInfoCount(UInt32) _MemberInfo.GetTypeInfoCount(UInt32) _MemberInfo.GetTypeInfoCount(UInt32) _MemberInfo.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。 Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from MemberInfo)
_MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。 Provides access to properties and methods exposed by an object.

(Inherited from MemberInfo)
_Type.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Type.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Type.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Type.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。 Maps a set of names to a corresponding set of dispatch identifiers.

_Type.GetTypeInfo(UInt32, UInt32, IntPtr) _Type.GetTypeInfo(UInt32, UInt32, IntPtr) _Type.GetTypeInfo(UInt32, UInt32, IntPtr) _Type.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。 Retrieves the type information for an object, which can then be used to get the type information for an interface.

_Type.GetTypeInfoCount(UInt32) _Type.GetTypeInfoCount(UInt32) _Type.GetTypeInfoCount(UInt32) _Type.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。 Retrieves the number of type information interfaces that an object provides (either 0 or 1).

_Type.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Type.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Type.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Type.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。 Provides access to properties and methods exposed by an object.

Applies to

Thread Safety

此类型是线程安全的。 This type is thread safe.

See Also