次の方法で共有


FieldBuilder.SetConstant メソッド

このフィールドの既定値を設定します。

Public Sub SetConstant( _
   ByVal defaultValue As Object _)
[C#]
public void SetConstant(objectdefaultValue);
[C++]
public: void SetConstant(Object* defaultValue);
[JScript]
public function SetConstant(
   defaultValue : Object);

パラメータ

  • defaultValue
    このフィールドの新しい既定値。

例外

例外の種類 条件
InvalidOperationException 外側の型が CreateType を使用して作成されています。

解説

defaultValue の型は、 BooleanSByteInt16Int32Int64ByteUInt16UInt32UInt64 、Single、Double、 DateTime 、Char、String、および Enum に限定されます。フィールドの型が Decimal または Object の場合、 defaultValue にできる値は null だけです。

必要条件

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

参照

FieldBuilder クラス | FieldBuilder メンバ | System.Reflection.Emit 名前空間