在我的 .net Windows 应用程序 (c#) 中,我想知道特定类的每个构造函数中的参数数量。我通过使用反射获得所有构造函数。是否可以获取每个构造函数的参数数量
?
提前致谢...
最佳答案
询问其参数(通过 GetParameters() ),然后询问数组的长度。
ConstructorInfo ctor = /* ... */
int numberOfArguments = ctor.GetParameters().Length;
关于c# - 如何在构造函数中获取参数数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6406841/