英語で読む

次の方法で共有


MethodBuilder.SetCustomAttribute メソッド

定義

カスタム属性を設定します。

オーバーロード

SetCustomAttribute(CustomAttributeBuilder)

カスタム属性ビルダーを使用して、カスタム属性を設定します。

SetCustomAttribute(ConstructorInfo, Byte[])

指定されたカスタム属性の blob を使用して、カスタム属性を設定します。

SetCustomAttribute(CustomAttributeBuilder)

ソース:
MethodBuilder.cs
ソース:
MethodBuilder.cs
ソース:
MethodBuilder.cs

カスタム属性ビルダーを使用して、カスタム属性を設定します。

C#
public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder);

パラメーター

customBuilder
CustomAttributeBuilder

カスタム属性を説明するヘルパー クラスのインスタンス。

例外

customBuildernullです。

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

注釈

メソッドは SetCustomAttribute 、2 つのメソッドを SetImplementationFlags 組み合わせて使用する場合に、 メソッドと対話できます。 詳細については、 メソッドの SetImplementationFlags 「解説」セクションを参照してください。

適用対象

.NET 10 およびその他のバージョン
製品 バージョン
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided), 2.1

SetCustomAttribute(ConstructorInfo, Byte[])

ソース:
MethodBuilder.cs
ソース:
MethodBuilder.cs
ソース:
MethodBuilder.cs

指定されたカスタム属性の blob を使用して、カスタム属性を設定します。

C#
public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute);
C#
[System.Runtime.InteropServices.ComVisible(true)]
public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute);

パラメーター

con
ConstructorInfo

カスタム属性のコンストラクター。

binaryAttribute
Byte[]

属性を表すバイト blob。

属性

例外

con または binaryAttributenull です。

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

注釈

の書式を設定 binaryAttributeする方法については、 共通言語インフラストラクチャ (CLI) 仕様のパーティション II のメタデータ仕様を参照してください。

メソッドは SetCustomAttribute 、2 つのメソッドを SetImplementationFlags 組み合わせて使用する場合に、 メソッドと対話できます。 詳細については、 メソッドの SetImplementationFlags 「解説」セクションを参照してください。

適用対象

.NET 10 およびその他のバージョン
製品 バージョン
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided), 2.1