繁体   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