次の方法で共有


PropertyBuilder.SetValue メソッド (Object, Object, BindingFlags, Binder, Object , CultureInfo)

指定したオブジェクトのプロパティ値に、指定した値を設定します。

Overrides Overloads Public Sub SetValue( _
   ByVal obj As Object, _   ByVal value As Object, _   ByVal invokeAttr As BindingFlags, _   ByVal binder As Binder, _   ByVal index() As Object, _   ByVal culture As CultureInfo _)
[C#]
public override void SetValue(objectobj,objectvalue,BindingFlagsinvokeAttr,Binderbinder,object[] index,CultureInfoculture);
[C++]
public: void SetValue(Object* obj,Object* value,BindingFlagsinvokeAttr,Binder* binder,Object* index __gc[],CultureInfo* culture);
[JScript]
public override function SetValue(
   obj : Object,value : Object,invokeAttr : BindingFlags,binder : Binder,index : Object[],culture : CultureInfo);

パラメータ

  • obj
    プロパティ値が返されるオブジェクト。
  • value
    このプロパティの新しい値。
  • invokeAttr
    呼び出し属性。 BindingFlags のビット フラグ InvokeMethodCreateInstanceStaticGetFieldSetFieldGetProperty 、または SetProperty にする必要があります。適切な呼び出し属性を指定する必要があります。静的メンバを呼び出す場合は、 BindingFlagsStatic フラグを設定する必要があります。
  • binder
    バインディング、引数型の強制変換、メンバの呼び出し、および、リフレクションを使用した MemberInfo オブジェクトの取得を有効にするオブジェクト。binder が null 参照 (Visual Basic では Nothing) の場合は、既定のバインダが使用されます。
  • index
    インデックス付きプロパティのインデックス値 (省略可能)。インデックス付きでないプロパティの場合は、この値を null 参照 (Visual Basic では Nothing) にする必要があります。
  • culture
    リソースのローカライズ対象のカルチャを表す CultureInfo オブジェクト。リソースがこのカルチャ用にローカライズされていない場合は、一致する対象を検索するために CultureInfo.Parent メソッドが連続して呼び出されます。この値が null 参照 (Visual Basic では Nothing) の場合は、 CultureInfo.CurrentUICulture プロパティから CultureInfo が取得されます。

例外

例外の種類 条件
NotSupportedException このメソッドはサポートされていません。

解説

プロパティの値を設定するには、Type.GetType または Assembly.GetType を使用してプロパティの親の型にリフレクションし、型から Reflection プロパティ オブジェクトを取得し、PropertyInfo.SetValue を呼び出します。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

PropertyBuilder クラス | PropertyBuilder メンバ | System.Reflection.Emit 名前空間 | PropertyBuilder.SetValue オーバーロードの一覧