System.Reflection.Emit.ModuleBuilder.GetField Method

Returns a module-level field, defined in the .sdata region of the portable executable (PE) file, that has the specified name and binding attributes.

Syntax

public override System.Reflection.FieldInfo GetField (string name, System.Reflection.BindingFlags bindingAttr)

Parameters

name
The field name.
bindingAttr
A combination of the BindingFlags bit flags used to control the search.

Returns

A field that has the specified name and binding attributes, or null if the field does not exist.

Remarks

When you emit dynamic assemblies, fields in the .sdata region of the portable executable (PE) file are defined by using the ModuleBuilder.DefineInitializedData(string, Byte[], System.Reflection.FieldAttributes) or ModuleBuilder.DefineUninitializedData(string, int, System.Reflection.FieldAttributes) methods.

Note:

Module-level fields cannot be retrieved until after the ModuleBuilder.CreateGlobalFunctions method has been called for the module.

Requirements

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0