共用方式為


PropertyBuilder.SetValue Method (Object, Object, BindingFlags, Binder, array<Object[], CultureInfo)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Sets the property value for the given object to the given value. This method is not supported.

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

Syntax

'Declaration
Public Overrides Sub SetValue ( _
    obj As Object, _
    value As Object, _
    invokeAttr As BindingFlags, _
    binder As Binder, _
    index As Object(), _
    culture As CultureInfo _
)
public override void SetValue(
    Object obj,
    Object value,
    BindingFlags invokeAttr,
    Binder binder,
    Object[] index,
    CultureInfo culture
)

Parameters

  • obj
    Type: System.Object
    The object whose property value will be returned.
  • invokeAttr
    Type: System.Reflection.BindingFlags
    The invocation attribute. This must be a bit flag from BindingFlags: InvokeMethod, CreateInstance, Static, GetField, SetField, GetProperty, or SetProperty. A suitable invocation attribute must be specified. If a static member is to be invoked, the Static flag of BindingFlags must be set.
  • binder
    Type: System.Reflection.Binder
    An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects using reflection. If binder is nulla null reference (Nothing in Visual Basic), the default binder is used.
  • index
    Type: array<System.Object[]
    Optional index values for indexed properties. This value should be nulla null reference (Nothing in Visual Basic) for non-indexed properties.
  • culture
    Type: System.Globalization.CultureInfo
    The CultureInfo object that represents the culture for which the resource is to be localized. Note that if the resource is not localized for this culture, the CultureInfo.Parent method will be called successively in search of a match. If this value is nulla null reference (Nothing in Visual Basic), the CultureInfo is obtained from the CultureInfo.CurrentUICulture property.

Exceptions

Exception Condition
NotSupportedException

This method is not supported.

Remarks

To set the value of a property, reflect on the property's parent type after the type is completed, using Type.GetType or Assembly.GetType. Retrieve the PropertyInfo object from the type, and call PropertyInfo.SetValue.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

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