System.Reflection.Binder.BindToField Method

Selects a field from the given set of fields, based on the specified criteria.

Syntax

public abstract FieldInfo BindToField (BindingFlags bindingAttr, FieldInfo[] match, object value, System.Globalization.CultureInfo culture)

Parameters

bindingAttr
A bitwise combination of System.Reflection.BindingFlags values.
match
The set of fields that are candidates for matching. For example, when a System.Reflection.Binder object is used by erload:System.Type.InvokeMember, this parameter specifies the set of fields that reflection has determined to be possible matches, typically because they have the correct member name. The default implementation provided by Type.DefaultBinder changes the order of this array.
value
The field value used to locate a matching field.
culture
An instance of System.Globalization.CultureInfo that is used to control the coercion of data types, in binder implementations that coerce types. If culture is null, the System.Globalization.CultureInfo for the current thread is used.

Returns

The matching field.

Remarks

If bindingAttr does not include BindingFlags.SetField, the default binder implementation provided by Type.DefaultBinder simply returns the first element of match. No selection is done.

This method controls the binding provided by Type.InvokeMember(string, BindingFlags, Binder, object, Object[], ParameterModifier[], System.Globalization.CultureInfo, String[]).

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0