System.Reflection Namespace

System.Reflection 命名空间包含通过检查托管代码中程序集、模块、成员、参数和其他实体的元数据来检索其相关信息的类型。 The System.Reflection namespace contains types that retrieve information about assemblies, modules, members, parameters, and other entities in managed code by examining their metadata. 这些类型还可用于操作加载类型的实例,例如挂钩事件或调用方法。 These types also can be used to manipulate instances of loaded types, for example to hook up events or to invoke methods. 若要动态创建类型,请使用 System.Reflection.Emit 命名空间。 To dynamically create types, use the System.Reflection.Emit namespace.

Classes

AmbiguousMatchException

当绑定到成员导致多个成员匹配绑定条件时引发的异常。 The exception that is thrown when binding to a member results in more than one member matching the binding criteria. 此类不能被继承。 This class cannot be inherited.

Assembly

表示一个程序集,它是一个可重用、无版本冲突并且可自我描述的公共语言运行时应用程序构建基块。 Represents an assembly, which is a reusable, versionable, and self-describing building block of a common language runtime application.

AssemblyAlgorithmIdAttribute

指定对程序集中的所有文件进行哈希计算的算法。 Specifies an algorithm to hash all files in an assembly. 此类不能被继承。 This class cannot be inherited.

AssemblyCompanyAttribute

定义程序集清单的公司名称自定义属性。 Defines a company name custom attribute for an assembly manifest.

AssemblyConfigurationAttribute

为程序集指定生成配置,例如发布或调试。 Specifies the build configuration, such as retail or debug, for an assembly.

AssemblyCopyrightAttribute

定义程序集清单的版权自定义属性。 Defines a copyright custom attribute for an assembly manifest.

AssemblyCultureAttribute

指定程序集支持的区域性。 Specifies which culture the assembly supports.

AssemblyDefaultAliasAttribute

定义程序集清单的友好默认别名。 Defines a friendly default alias for an assembly manifest.

AssemblyDelaySignAttribute

指定程序集在创建时未完全签名。 Specifies that the assembly is not fully signed when created.

AssemblyDescriptionAttribute

提供程序集的文本说明。 Provides a text description for an assembly.

AssemblyExtensions
AssemblyFileVersionAttribute

指示编译器使用 Win32 文件版本资源的特定版本号。 Instructs a compiler to use a specific version number for the Win32 file version resource. Win32 文件版本不需要与程序集的版本号相同。 The Win32 file version is not required to be the same as the assembly's version number.

AssemblyFlagsAttribute

为程序集指定 AssemblyNameFlags 标志的按位组合,从而描述实时 (JIT) 编译器选项,该程序集是否可重定目标以及是否有完整或已标记化的公钥。 Specifies a bitwise combination of AssemblyNameFlags flags for an assembly, describing just-in-time (JIT) compiler options, whether the assembly is retargetable, and whether it has a full or tokenized public key. 此类不能被继承。 This class cannot be inherited.

AssemblyInformationalVersionAttribute

定义程序集清单的其他版本信息。 Defines additional version information for an assembly manifest.

AssemblyKeyFileAttribute

指定包含用于生成强名称的密钥对的文件的名称。 Specifies the name of a file containing the key pair used to generate a strong name.

AssemblyKeyNameAttribute

指定包含用于生成强名称的密钥对的 CSP 中的密钥容器的名称。 Specifies the name of a key container within the CSP containing the key pair used to generate a strong name.

AssemblyMetadataAttribute

定义经过修饰的程序集的密钥/值元数据对。 Defines a key/value metadata pair for the decorated assembly.

AssemblyName

完整描述程序集的唯一标识。 Describes an assembly's unique identity in full.

AssemblyNameProxy

提供可远程使用的 AssemblyName 版本。 Provides a remotable version of the AssemblyName.

AssemblyProductAttribute

定义程序集清单的产品名自定义属性。 Defines a product name custom attribute for an assembly manifest.

AssemblySignatureKeyAttribute

提供从更早、更简单的名称键值到更大、散列值算法更安全的键值的迁移。 Provides migration from an older, simpler strong name key to a larger key with a stronger hashing algorithm.

AssemblyTitleAttribute

提供程序集的说明。 Specifies a description for an assembly.

AssemblyTrademarkAttribute

定义程序集清单的商标自定义属性。 Defines a trademark custom attribute for an assembly manifest.

AssemblyVersionAttribute

指定正在属性化的程序集的版本。 Specifies the version of the assembly being attributed.

Binder

从候选者列表中选择一个成员,并执行实参类型到形参类型的类型转换。 Selects a member from a list of candidates, and performs type conversion from actual argument type to formal argument type.

ConstructorInfo

发现类构造函数的属性,并提供对构造函数元数据的访问权限。 Discovers the attributes of a class constructor and provides access to constructor metadata.

CustomAttributeData

提供对加载到仅反射上下文的程序集、模块、类型、成员和参数的自定义属性数据的访问权限。 Provides access to custom attribute data for assemblies, modules, types, members and parameters that are loaded into the reflection-only context.

CustomAttributeExtensions

包含用于检索自定义属性的静态方法。 Contains static methods for retrieving custom attributes.

CustomAttributeFormatException

当自定义特性的二进制格式无效时引发的异常。 The exception that is thrown when the binary format of a custom attribute is invalid.

DefaultMemberAttribute

定义某类型的成员,该成员是 InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) 使用的默认成员。 Defines the member of a type that is the default member used by InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]).

DispatchProxy
EventInfo

发现事件的属性并提供对事件元数据的访问权限。 Discovers the attributes of an event and provides access to event metadata.

EventInfoExtensions
ExceptionHandlingClause

表示结构化异常处理块中的子句。 Represents a clause in a structured exception-handling block.

FieldInfo

发现字段的属性并提供对字段元数据的访问权限。 Discovers the attributes of a field and provides access to field metadata.

IntrospectionExtensions

包含转换的 Type 对象的方法。 Contains methods for converting Type objects.

InvalidFilterCriteriaException

当筛选条件对正使用的筛选器类型无效时,在 FindMembers(MemberTypes, BindingFlags, MemberFilter, Object) 中引发的异常。 The exception that is thrown in FindMembers(MemberTypes, BindingFlags, MemberFilter, Object) when the filter criteria is not valid for the type of filter you are using.

LocalVariableInfo

发现局部变量的属性,并提供对本地变量元数据的访问权限。 Discovers the attributes of a local variable and provides access to local variable metadata.

ManifestResourceInfo

提供对清单资源的访问权限,清单资源是用于描述应用程序依赖项的 XML 文件。 Provides access to manifest resources, which are XML files that describe application dependencies.

MemberInfo

获取有关成员属性的信息并提供对成员元数据的访问权限。 Obtains information about the attributes of a member and provides access to member metadata.

MemberInfoExtensions
MethodBase

提供有关方法和构造函数的信息。 Provides information about methods and constructors.

MethodBody

提供对方法体的元数据和 MSIL 的访问权限。 Provides access to the metadata and MSIL for the body of a method.

MethodInfo

发现方法的属性并提供对方法元数据的访问。 Discovers the attributes of a method and provides access to method metadata.

MethodInfoExtensions
Missing

表示缺少的 Object Represents a missing Object. 此类不能被继承。 This class cannot be inherited.

Module

对模块执行反射。 Performs reflection on a module.

ModuleExtensions
ObfuscateAssemblyAttribute

指示模糊处理工具对适当的程序集类型使用其标准模糊处理规则。 Instructs obfuscation tools to use their standard obfuscation rules for the appropriate assembly type.

ObfuscationAttribute

指示模糊处理工具对程序集、类型或成员采取指定的操作。 Instructs obfuscation tools to take the specified actions for an assembly, type, or member.

ParameterInfo

发现参数的属性并提供对参数元数据的访问权限。 Discovers the attributes of a parameter and provides access to parameter metadata.

Pointer

为指针提供包装类。 Provides a wrapper class for pointers.

PropertyInfo

发现属性 (Property) 的属性 (Attribute) 并提供对属性 (Property) 元数据的访问。 Discovers the attributes of a property and provides access to property metadata.

PropertyInfoExtensions
ReflectionContext

表示可以提供反射对象的上下文。 Represents a context that can provide reflection objects.

ReflectionTypeLoadException

当模块中有任何类无法加载时由 GetTypes() 方法引发的异常。 The exception that is thrown by the GetTypes() method if any of the classes in a module cannot be loaded. 此类不能被继承。 This class cannot be inherited.

RuntimeReflectionExtensions

提供可在运行时检索类型相关信息的方法。 Provides methods that retrieve information about types at run time.

StrongNameKeyPair

封装对公钥或私钥对的访问,该公钥或私钥对用于为强名称程序集创建签名。 Encapsulates access to a public or private key pair used to sign strong name assemblies.

TargetException

表示尝试调用无效目标时引发的异常。 Represents the exception that is thrown when an attempt is made to invoke an invalid target.

TargetInvocationException

由通过反射调用的方法引发的异常。 The exception that is thrown by methods invoked through reflection. 此类不能被继承。 This class cannot be inherited.

TargetParameterCountException

当调用的参数数目与预期的数目不匹配时引发的异常。 The exception that is thrown when the number of parameters for an invocation does not match the number expected. 此类不能被继承。 This class cannot be inherited.

TypeDelegator

包装 Type 对象并将所有方法委托给该 Type Wraps a Type object and delegates methods to that Type.

TypeExtensions
TypeInfo

表示类类型、接口类型、数组类型、值类型、枚举类型、类型参数、泛型类型定义,以及开放或封闭构造的泛型类型的类型声明。 Represents type declarations for class types, interface types, array types, value types, enumeration types, type parameters, generic type definitions, and open or closed constructed generic types.

Structs

CustomAttributeNamedArgument

表示仅反射上下文中的自定义属性的命名自变量。 Represents a named argument of a custom attribute in the reflection-only context.

CustomAttributeTypedArgument

表示只反射上下文中的自定义特性的参数,或数组参数的元素。 Represents an argument of a custom attribute in the reflection-only context, or an element of an array argument.

InterfaceMapping

检索接口到实现该接口的类上的实际方法的映射。 Retrieves the mapping of an interface into the actual methods on a class that implements that interface.

ParameterModifier

将修饰符附加到参数,以便绑定可与在其中修改了类型的参数签名一起使用。 Attaches a modifier to parameters so that binding can work with parameter signatures in which the types have been modified.

Interfaces

ICustomAttributeProvider

为支持自定义属性的反映对象提供自定义属性。 Provides custom attributes for reflection objects that support them.

ICustomTypeProvider

表示提供自定义类型的对象。 Represents an object that provides a custom type.

IReflect

IDispatch 接口进行互操作。 Interoperates with the IDispatch interface.

IReflectableType

表示可以反映的类型。 Represents a type that you can reflect over.

Enums

AssemblyContentType

提供有关程序集中包含的代码类型的信息。 Provides information about the type of code contained in an assembly.

AssemblyFlags
AssemblyHashAlgorithm
AssemblyNameFlags

提供有关 Assembly 引用的信息。 Provides information about an Assembly reference.

BindingFlags

指定控制绑定以及通过反射执行成员和类型搜索的方式的标记。 Specifies flags that control binding and the way in which the search for members and types is conducted by reflection.

CallingConventions

定义方法的有效调用约定。 Defines the valid calling conventions for a method.

DeclarativeSecurityAction
EventAttributes

指定事件的属性。 Specifies the attributes of an event.

ExceptionHandlingClauseOptions

标识异常处理子句的种类。 Identifies kinds of exception-handling clauses.

FieldAttributes

指定描述字段属性的标志。 Specifies flags that describe the attributes of a field.

GenericParameterAttributes

描述对泛型类型或泛型方法的泛型类型参数的约束。 Describes the constraints on a generic type parameter of a generic type or method.

ImageFileMachine

标识可执行文件的目标平台。 Identifies the platform targeted by an executable.

ManifestResourceAttributes
MemberTypes

标记被定义为 MemberInfo 的派生类的每种成员类型。 Marks each type of member that is defined as a derived class of MemberInfo.

MethodAttributes

指定方法属性的标志。 Specifies flags for method attributes. 这些标志在 Corhdr.h 文件中进行定义。 These flags are defined in the corhdr.h file.

MethodImplAttributes

指定方法实现的属性的标志。 Specifies flags for the attributes of a method implementation.

MethodImportAttributes
MethodSemanticsAttributes
ParameterAttributes

定义可以与参数相关联的属性。 Defines the attributes that can be associated with a parameter. 这些属性在 CorHdr.h 中进行定义。 These are defined in CorHdr.h.

PortableExecutableKinds

标识可执行文件中代码的特性。 Identifies the nature of the code in an executable file.

ProcessorArchitecture

标识可执行文件的目标平台的处理器和每字位数。 Identifies the processor and bits-per-word of the platform targeted by an executable.

PropertyAttributes

定义可以与属性相关联的属性。 Defines the attributes that can be associated with a property. 这些属性值在 Corhdr.h 中进行定义。 These attribute values are defined in corhdr.h.

ResourceAttributes

指定清单资源的属性。 Specifies the attributes for a manifest resource.

ResourceLocation

指定资源位置。 Specifies the resource location.

TypeAttributes

指定类型属性。 Specifies type attributes.

Delegates

MemberFilter

表示用于筛选以 MemberInfo 对象数组表示的成员列表的委托。 Represents a delegate that is used to filter a list of members represented in an array of MemberInfo objects.

ModuleResolveEventHandler

表示将要处理 AssemblyModuleResolve 事件的方法。 Represents the method that will handle the ModuleResolve event of an Assembly.

TypeFilter

筛选 Type 对象数组中表示的类。 Filters the classes represented in an array of Type objects.