Binder.BindToField Method

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

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)


Public MustOverride Function BindToField ( _
    bindingAttr As BindingFlags, _
    match As FieldInfo(), _
    value As Object, _
    culture As CultureInfo _
) As FieldInfo
public abstract FieldInfo BindToField(
    BindingFlags bindingAttr,
    FieldInfo[] match,
    Object value,
    CultureInfo culture


  • match
    Type: array<System.Reflection.FieldInfo[]
    The set of fields that are candidates for matching. For example, when a Binder object is used by 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
    Type: System.Object
    The field value used to locate a matching field.
  • culture
    Type: System.Globalization.CultureInfo
    An instance of CultureInfo that is used to control the coercion of data types, in binder implementations that coerce types. If culture is nulla null reference (Nothing in Visual Basic), the CultureInfo for the current thread is used.
    Note    For example, if a binder implementation allows coercion of string values to numeric types, this parameter is necessary to convert a String that represents 1000 to a Double value, because 1000 is represented differently by different cultures. The default binder does not do such string coercions.

Return Value

Type: System.Reflection.FieldInfo
The matching field.


Exception Condition

For the default binder, bindingAttr includes BindingFlags.SetField, and match contains multiple fields that are equally good matches for value. For example, value contains a MyClass object that implements the IMyClass interface, and match contains a field of type MyClass and a field of type IMyClass.


For the default binder, bindingAttr includes BindingFlags.SetField, and match contains no fields that can accept value.


For the default binder, bindingAttr includes BindingFlags.SetField, and match is nulla null reference (Nothing in Visual Basic) or an empty array.


bindingAttr includes BindingFlags.SetField, and value is nulla null reference (Nothing in Visual Basic).


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.

Version Information


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.