ModuleBuilder.GetField(String, BindingFlags) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回在可移植可执行文件 (PE) 文件的 .sdata 区域中定义的模块级字段,该字段具有指定的名称和绑定属性。
public:
override System::Reflection::FieldInfo ^ GetField(System::String ^ name, System::Reflection::BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Fields might be removed")]
public override System.Reflection.FieldInfo? GetField(string name, System.Reflection.BindingFlags bindingAttr);
public override System.Reflection.FieldInfo? GetField(string name, System.Reflection.BindingFlags bindingAttr);
public override System.Reflection.FieldInfo GetField(string name, System.Reflection.BindingFlags bindingAttr);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Fields might be removed")>]
override this.GetField : string * System.Reflection.BindingFlags -> System.Reflection.FieldInfo
override this.GetField : string * System.Reflection.BindingFlags -> System.Reflection.FieldInfo
Public Overrides Function GetField (name As String, bindingAttr As BindingFlags) As FieldInfo
参数
- name
- String
字段名称。
- bindingAttr
- BindingFlags
用于控制搜索的 BindingFlags 位标志的组合。
返回
具有指定名称和绑定属性的字段,或者 null 该字段不存在。
- 属性
例外
参数 name 为 null.
注解
发出动态程序集时,可以使用或DefineInitializedData方法定义DefineUninitializedData可移植可执行文件 (PE) 文件的 .sdata 区域中的字段。
Important
在为模块调用方法之后, CreateGlobalFunctions 才能检索模块级字段。