SignatureHelper.AddArgument 方法

定義

加入引數至簽章。

多載

AddArgument(Type)

加入引數至簽章。

AddArgument(Type, Boolean)

將指定之型別的引數加入簽章,指定該引數是否為固定 (Pin) 。

AddArgument(Type, Type[], Type[])

使用指定的自訂修飾詞,將引數加入簽章。

AddArgument(Type)

來源:
SignatureHelper.cs
來源:
SignatureHelper.cs
來源:
SignatureHelper.cs

加入引數至簽章。

C#
public void AddArgument (Type clsArgument);

參數

clsArgument
Type

引數型別。

例外狀況

簽章已經完成。

clsArgumentnull

備註

若要新增具有選擇性或必要自定義修飾詞的自變數,請使用 AddArgument(Type, Type[], Type[]) 方法多載。

適用於

.NET 9 和其他版本
產品 版本
.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
.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, 2.1

AddArgument(Type, Boolean)

來源:
SignatureHelper.cs
來源:
SignatureHelper.cs
來源:
SignatureHelper.cs

將指定之型別的引數加入簽章,指定該引數是否為固定 (Pin) 。

C#
public void AddArgument (Type argument, bool pinned);

參數

argument
Type

引數型別。

pinned
Boolean

如果引數為固定 (Pin),則為 true,否則為 false

例外狀況

argumentnull

備註

若要新增具有選擇性或必要自定義修飾詞的自變數,請使用 AddArgument(Type, Type[], Type[]) 方法多載。

適用於

.NET 9 和其他版本
產品 版本
.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
.NET Framework 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, 2.1

AddArgument(Type, Type[], Type[])

來源:
SignatureHelper.cs
來源:
SignatureHelper.cs
來源:
SignatureHelper.cs

使用指定的自訂修飾詞,將引數加入簽章。

C#
public void AddArgument (Type argument, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers);
C#
public void AddArgument (Type argument, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers);

參數

argument
Type

引數型別。

requiredCustomModifiers
Type[]

型別的陣列,表示引數的必要自訂修飾詞,例如 IsConstIsBoxed。 如果引數沒有必要的自訂修飾詞,請指定 null

optionalCustomModifiers
Type[]

型別的陣列,表示引數的選擇性自訂修飾詞,例如 IsConstIsBoxed。 如果引數沒有選擇性自訂修飾詞,請指定 null

例外狀況

argumentnull

-或-

requiredCustomModifiersoptionalCustomModifiers 的項目為 null

簽章已經完成。

-或-

其中一個指定的自訂修飾詞為陣列型別。

-或-

其中一個指定的自訂修飾詞為開放泛型型別。 也就是說,自訂修飾詞的 ContainsGenericParameters 屬性為 true

備註

System.Runtime.CompilerServices請參閱代表自定義修飾詞之類別的命名空間。

適用於

.NET 9 和其他版本
產品 版本
.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
.NET Framework 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, 2.1