簡體   English   中英

Mono.Cecil-如何知道一個具有可變參數的方法?

[英]Mono.Cecil - How to know a method has variable-arguments?

在C#中,我們有__arglist關鍵字,它使方法的變量參數像這樣:

public static void PrintFormat(string format, __arglist) 
{
    ....
}

它編譯為:

.method public hidebysig static vararg void PrintFormat ( string format ) cil managed 
{
    ....
} 

注意vararg 那么,如何知道Mono.Cecil中具有可變參數的方法呢?

@JeroenMostert指出了這一點。 來源

public static bool IsVarArg (this IMethodSignature self)
{
    return (self.CallingConvention & MethodCallingConvention.VarArg) != 0;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM