MethodBuilder.SetSymCustomAttribute メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > MethodBuilder.SetSymCustomAttribute メソッドの意味・解説 

MethodBuilder.SetSymCustomAttribute メソッド

BLOB使用してシンボリック カスタム属性設定します

名前空間: System.Reflection.Emit
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub SetSymCustomAttribute ( _
    name As String, _
    data As Byte() _
)
Dim instance As MethodBuilder
Dim name As String
Dim data As Byte()

instance.SetSymCustomAttribute(name, data)
public void SetSymCustomAttribute (
    string name,
    byte[] data
)
public:
void SetSymCustomAttribute (
    String^ name, 
    array<unsigned char>^ data
)
public void SetSymCustomAttribute (
    String name, 
    byte[] data
)
public function SetSymCustomAttribute (
    name : String, 
    data : byte[]
)

パラメータ

name

シンボリック カスタム属性の名前。

data

シンボリック カスタム属性の値を表すバイト BLOB

例外例外
例外種類条件

InvalidOperationException

外側の型が CreateType を使用して作成されています。

または

このメソッド格納しているモジュールが、デバッグ モジュールではありません。

または

現在のメソッドでは、IsGenericMethod プロパティtrue ですが、IsGenericMethodDefinition プロパティfalse です。

解説解説
使用例使用例

SetSymCustomAttribute メソッド使用してメソッド割り当てられカスタム属性の名前とキーバイト値を設定する方法次のコード例示します

Dim myMethod As MethodBuilder = myDynamicType.DefineMethod("MyMethod",
 _
               MethodAttributes.Public, GetType(Integer),
 _
               New Type() {GetType(String)})

' A 128-bit key in hex form, represented as a byte array.
Dim keyVal As Byte() = 
 {&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, _
             &H0, &H0, &H0, &H0, &H0, &H60, &HFF, &HFF}

Dim encoder As New System.Text.ASCIIEncoding()
Dim symFullName As Byte()
 = encoder.GetBytes("My Dynamic Method")

myMethod.SetSymCustomAttribute("SymID", keyVal)
myMethod.SetSymCustomAttribute("SymFullName", symFullName)

MethodBuilder myMethod = myDynamicType.DefineMethod("MyMethod",
                    MethodAttributes.Public,
                    typeof(int),
                    new Type[] { typeof(string)
 });

// A 128-bit key in hex form, represented as a byte array.
byte[] keyVal = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
          0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xFF, 0xFF };    

System.Text.ASCIIEncoding encoder = new System.Text.ASCIIEncoding();
byte[] symFullName = encoder.GetBytes("My Dynamic Method");

myMethod.SetSymCustomAttribute("SymID", keyVal);
myMethod.SetSymCustomAttribute("SymFullName", symFullName);

array<Type^>^ temp0 = { String::typeid };
MethodBuilder^ myMethod = myDynamicType->DefineMethod( "MyMethod",
                          MethodAttributes::Public,
                          int::typeid,
                          temp0 );

// A 128-bit key in hex form, represented as a Byte array.
array<Byte>^ keyVal = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                        0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xFF, 0xFF};

System::Text::ASCIIEncoding^ encoder = gcnew System::Text::ASCIIEncoding;
array<Byte>^ symFullName = encoder->GetBytes( "My Dynamic Method"
 );

myMethod->SetSymCustomAttribute( "SymID", keyVal );
myMethod->SetSymCustomAttribute( "SymFullName", symFullName );
MethodBuilder myMethod = myDynamicType.DefineMethod("MyMethod", 
    MethodAttributes.Public, int.class.ToType(),
 
    new Type[] { String.class.ToType() });

// A 128-bit key in hex form, represented as a byte array.
ubyte keyVal[] =  { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
    0x0, 0x0, 0x0, 0x0, 0x60, 0xFF, 0xFF };
System.Text.ASCIIEncoding encoder = new System.Text.ASCIIEncoding();
ubyte symFullName[] = encoder.GetBytes("My Dynamic Method");
myMethod.SetSymCustomAttribute("SymID", keyVal);
myMethod.SetSymCustomAttribute("SymFullName", symFullName);
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MethodBuilder クラス
MethodBuilder メンバ
System.Reflection.Emit 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からMethodBuilder.SetSymCustomAttribute メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からMethodBuilder.SetSymCustomAttribute メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からMethodBuilder.SetSymCustomAttribute メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

MethodBuilder.SetSymCustomAttribute メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



MethodBuilder.SetSymCustomAttribute メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS