Type 类

定义

表示类型声明:类类型、接口类型、数组类型、值类型、枚举类型、类型参数、泛型类型定义,以及开放或封闭构造的泛型类型。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)]
[System.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
继承
派生
属性
实现

示例

下面的示例演示了的Type几个典型功能。The following example shows a few representative features of Type. 运算符C# typeofType StringVisual Basic中的运算符)用于获取表示的对象。GetTypeThe C# typeof operator (GetType operator in Visual Basic) is used to get a Type object representing String. Type MethodInfo String.Substring此对象中,方法用于获取,它表示采用起始位置和长度的重载。 GetMethodFrom this Type object, the GetMethod method is used to get a MethodInfo representing the String.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来对字符串 "Hello,World!" Substring调用方法,并显示结果。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.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".

注解

TypeSystem.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. 由于所有托管类型都派生ObjectGetType ,因此可在任何类型的实例上调用方法。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.

  • 、和方法返回对象Type ,这些对象表示在模块中定义的类型。 Module.FindTypes Module.GetTypes Module.GetTypeThe 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 Type.Module通过或方法Assembly.GetModules获取实例,也可以通过属性获取的实例。) Assembly.GetModule(You can obtain an instance of Module through the Assembly.GetModule or Assembly.GetModules method, or through the Type.Module property.)

  • 对象包含若干方法,用于检索在程序集中定义的类,包括Assembly.GetTypeAssembly.GetTypesAssembly.GetExportedTypesSystem.Reflection.AssemblyThe 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 TypeThe GetElementType method returns a Type object that represents the element.

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

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

  • 提供GetTypeFromProgIDGetTypeFromCLSID方法是为了实现 COM 互操作性。The GetTypeFromProgID and GetTypeFromCLSID methods are provided for COM interoperability. 它们返回一个Type对象,该对象表示ProgID由或CLSID指定的类型。They 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# C++ 运算符、GetType运算符和 Visual Basic 运算符获取Type类型的对象。 typeid typeofThe C# typeof operator, the C++ typeid operator, and the Visual Basic GetType operator obtain the Type object for a type.

  • 方法返回一个Type对象,该对象表示构造的泛型类型(如果其ContainsGenericParameters属性返回true,则为开放式构造类型); 否则返回一个封闭式构造类型。 MakeGenericTypeThe 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.

  • MakeArrayType C#、ref和方法返回Type分别表示指定类型的数组、指向指定类型的指针和引用参数类型的对象(在中, MakeByRefType MakePointerType 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

继承者说明

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

构造函数

Type()

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

字段

Delimiter

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

EmptyTypes

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

FilterAttribute

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

FilterName

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

FilterNameIgnoreCase

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

Missing

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

属性

Assembly

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

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

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

BaseType

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

ContainsGenericParameters

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

CustomAttributes

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

(继承自 MemberInfo)
DeclaringMethod

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

DeclaringType

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

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

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

GenericParameterAttributes

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

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

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

GUID

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

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

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

IsAnsiClass

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

IsArray

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

IsAutoClass

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

IsAutoLayout

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

IsByRef

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

IsByRefLike
IsClass

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

IsCollectible

获取一个值,该值指示此 MemberInfo 对象是否是包含在可回收的 AssemblyLoadContext 中的程序集的一部分。Gets a value that indicates whether this MemberInfo object is part of an assembly held in a collectible AssemblyLoadContext.

(继承自 MemberInfo)
IsCOMObject

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

IsConstructedGenericType

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

IsContextful

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

IsEnum

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

IsExplicitLayout

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

IsGenericMethodParameter
IsGenericParameter

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

IsGenericType

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

IsGenericTypeDefinition

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

IsGenericTypeParameter
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

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

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

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

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

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

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

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

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

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

IsNestedPublic

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

IsNotPublic

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

IsPointer

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

IsPrimitive

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

IsPublic

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

IsSealed

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

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

获取一个值,该值指示当前类型在当前信任级别上是否是安全可靠关键的;即它是否可以执行关键操作并可以由透明代码访问。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

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

IsSerializable

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

IsSignatureType
IsSpecialName

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

IsSZArray
IsTypeDefinition
IsUnicodeClass

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

IsValueType

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

IsVariableBoundArray
IsVisible

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

MemberType

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

MetadataToken

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

(继承自 MemberInfo)
Module

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

Name

在派生类中覆盖时,获取当前类型的名称。When overridden in a derived class, gets the name of the current type.

Namespace

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

ReflectedType

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

StructLayoutAttribute

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

TypeHandle

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

TypeInitializer

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

UnderlyingSystemType

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

方法

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)

确定当前 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)

返回表示接口(由当前 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)

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

GetArrayRank()

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

GetAttributeFlagsImpl()

在派生类中重写时,实现 Attributes 属性,并获取枚举值的按位组合(它指示与 Type 关联的特性)。When overridden in a derived class, implements the Attributes property and gets a bitwise combination of enumeration values that indicate the attributes associated with the Type.

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[])

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

GetConstructor(Type[])

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

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()

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

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)

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

(继承自 MemberInfo)
GetCustomAttributes(Type, Boolean)

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

(继承自 MemberInfo)
GetCustomAttributesData()

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

(继承自 MemberInfo)
GetDefaultMembers()

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

GetElementType()

当在派生类中重写时,返回当前数组、指针或引用类型包含的或引用的对象的 TypeWhen 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)

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

GetEnumNames()

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

GetEnumUnderlyingType()

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

GetEnumValues()

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

GetEvent(String)

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

GetEvent(String, BindingFlags)

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

GetEvents()

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

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)

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

GetField(String, BindingFlags)

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

GetFields()

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

GetFields(BindingFlags)

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

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()

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

GetGenericTypeDefinition()

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

GetHashCode()

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

GetInterface(String)

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

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)

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

GetInterfaces()

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

GetMember(String)

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

GetMember(String, BindingFlags)

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

GetMember(String, MemberTypes, BindingFlags)

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

GetMembers()

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

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)

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

GetMethod(String, BindingFlags)

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

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[])

使用指定绑定约束,搜索其参数与指定参数类型及修饰符匹配的指定方法。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, Type[], ParameterModifier[])
GetMethod(String, Int32, Type[])
GetMethod(String, Int32, Type[], ParameterModifier[])
GetMethod(String, Type[])

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

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[])

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

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

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)

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

GetNestedType(String, BindingFlags)

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

GetNestedTypes()

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

GetNestedTypes(BindingFlags)

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

GetProperties()

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

GetProperties(BindingFlags)

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

GetProperty(String)

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

GetProperty(String, BindingFlags)

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

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)

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

GetProperty(String, Type, Type[])

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

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

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

GetProperty(String, Type[])

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

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()

获取当前 TypeGets the current Type.

GetType(String)

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

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)

获取具有指定名称的 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>)

获取具有指定名称的类型,(可选)提供自定义方法以解析程序集和该类型。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)

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

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

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

GetTypeCode(Type)

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

GetTypeCodeImpl()

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

GetTypeFromCLSID(Guid)

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

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)

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

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)

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

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)

获取与指定程序标识符 (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)

从指定服务器获取与指定程序标识符 (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)

从指定服务器获取与指定程序标识符 (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)

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

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) (继承自 MemberInfo)
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)

使用指定的绑定约束和匹配的指定参数列表及区域性来调用指定成员。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[])

当在派生类中重写时,使用指定的绑定约束并匹配指定的参数列表、修饰符和区域性,调用指定成员。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()

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

IsAssignableFrom(Type)

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

IsByRefImpl()

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

IsCOMObjectImpl()

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

IsContextfulImpl()

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

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.

(继承自 MemberInfo)
IsEnumDefined(Object)

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

IsEquivalentTo(Type)

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

IsInstanceOfType(Object)

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

IsMarshalByRefImpl()

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

IsPointerImpl()

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

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)

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

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()

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

MakeArrayType(Int32)

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

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)
MakeGenericSignatureType(Type, Type[])

创建一个泛型签名类型,该类型允许第三方重新实现反射,从而完全支持在查询类型成员时使用签名类型。Creates a generic signature type, which allows third party reimplementations of Reflection to fully support the use of signature types in querying type members.

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()

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

MemberwiseClone()

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

(继承自 Object)
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()

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

操作员

Equality(Type, Type)

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

Inequality(Type, Type)

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

显式界面实现

_MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

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

(继承自 MemberInfo)
_MemberInfo.GetType()

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

(继承自 MemberInfo)
_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.

(继承自 MemberInfo)
_MemberInfo.GetTypeInfoCount(UInt32)

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

(继承自 MemberInfo)
_MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

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

(继承自 MemberInfo)
_Type.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

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

_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)

检索对象提供的类型信息接口的数量(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)

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

ICustomAttributeProvider.GetCustomAttributes(Boolean) (继承自 MemberInfo)
ICustomAttributeProvider.GetCustomAttributes(Type, Boolean) (继承自 MemberInfo)
ICustomAttributeProvider.IsDefined(Type, Boolean) (继承自 MemberInfo)

扩展方法

GetCustomAttribute(MemberInfo, Type)

检索应用于指定成员的指定类型的自定义特性。Retrieves a custom attribute of a specified type that is applied to a specified member.

GetCustomAttribute(MemberInfo, Type, Boolean)

检索应用于指定成员的指定类型的自定义特性,并可选择检查该成员的上级。Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttribute<T>(MemberInfo)

检索应用于指定成员的指定类型的自定义特性。Retrieves a custom attribute of a specified type that is applied to a specified member.

GetCustomAttribute<T>(MemberInfo, Boolean)

检索应用于指定成员的指定类型的自定义特性,并可选择检查该成员的上级。Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes(MemberInfo)

检索应用于指定成员的自定义特性集合。Retrieves a collection of custom attributes that are applied to a specified member.

GetCustomAttributes(MemberInfo, Boolean)

检索应用于指定成员的自定义特性集合,并可选择检查该成员的上级。Retrieves a collection of custom attributes that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes(MemberInfo, Type)

检索应用于指定成员的指定类型的自定义特性集合。Retrieves a collection of custom attributes of a specified type that are applied to a specified member.

GetCustomAttributes(MemberInfo, Type, Boolean)

检索应用于指定成员的指定类型的自定义特性集合,并可选择检查该成员的上级。Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member.

GetCustomAttributes<T>(MemberInfo)

检索应用于指定成员的指定类型的自定义特性集合。Retrieves a collection of custom attributes of a specified type that are applied to a specified member.

GetCustomAttributes<T>(MemberInfo, Boolean)

检索应用于指定成员的指定类型的自定义特性集合,并可选择检查该成员的上级。Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member.

IsDefined(MemberInfo, Type)

确定是否将指定类型的任何自定义属性应用于指定的成员。Indicates whether custom attributes of a specified type are applied to a specified member.

IsDefined(MemberInfo, Type, Boolean)

指示一个指定类型的自定义特性是否应用于一个指定的数字,并选择性地应用于其的上级。Indicates whether custom attributes of a specified type are applied to a specified member, and, optionally, applied to its ancestors.

GetTypeInfo(Type)

返回指定类型的 TypeInfo 表示形式。Returns the TypeInfo representation of the specified type.

GetMetadataToken(MemberInfo)

获取给定成员的元数据令牌(如果可用)。Gets a metadata token for the given member, if available.

HasMetadataToken(MemberInfo)

返回表示元数据令牌是否可用于指定的成员的值。Returns a value that indicates whether a metadata token is available for the specified member.

GetRuntimeEvent(Type, String)

检索一个表示指定事件的对象。Retrieves an object that represents the specified event.

GetRuntimeEvents(Type)

检索表示指定类型定义的所有事件的集合。Retrieves a collection that represents all the events defined on a specified type.

GetRuntimeField(Type, String)

检索表示指定字段的对象。Retrieves an object that represents a specified field.

GetRuntimeFields(Type)

检索表示指定类型定义的所有字段的集合。Retrieves a collection that represents all the fields defined on a specified type.

GetRuntimeMethod(Type, String, Type[])

检索表示指定方法的对象。Retrieves an object that represents a specified method.

GetRuntimeMethods(Type)

检索表示指定类型定义的所有方法的集合。Retrieves a collection that represents all methods defined on a specified type.

GetRuntimeProperties(Type)

检索表示指定类型定义的所有属性的集合。Retrieves a collection that represents all the properties defined on a specified type.

GetRuntimeProperty(Type, String)

检索表示指定属性的对象。Retrieves an object that represents a specified property.

GetConstructor(Type, Type[])
GetConstructors(Type)
GetConstructors(Type, BindingFlags)
GetDefaultMembers(Type)
GetEvent(Type, String)
GetEvent(Type, String, BindingFlags)
GetEvents(Type)
GetEvents(Type, BindingFlags)
GetField(Type, String)
GetField(Type, String, BindingFlags)
GetFields(Type)
GetFields(Type, BindingFlags)
GetGenericArguments(Type)
GetInterfaces(Type)
GetMember(Type, String)
GetMember(Type, String, BindingFlags)
GetMembers(Type)
GetMembers(Type, BindingFlags)
GetMethod(Type, String)
GetMethod(Type, String, BindingFlags)
GetMethod(Type, String, Type[])
GetMethods(Type)
GetMethods(Type, BindingFlags)
GetNestedType(Type, String, BindingFlags)
GetNestedTypes(Type, BindingFlags)
GetProperties(Type)
GetProperties(Type, BindingFlags)
GetProperty(Type, String)
GetProperty(Type, String, BindingFlags)
GetProperty(Type, String, Type)
GetProperty(Type, String, Type, Type[])
IsAssignableFrom(Type, Type)
IsInstanceOfType(Type, Object)

适用于

线程安全性

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

另请参阅