
[英]Why Visual Studio automatically creates ApiController with all async methods? How to create ApiController with sync methods in it?
[英]How to add argument to all methods with the same name in Visual Studio in this case?
我有一个声明如下的方法,它在一个项目的数百个地方使用:
public void myMethod(string myString, int myInt)
{
//do something..
}
现在我可以添加另一个参数 myBoolean 并使方法定义为:
public void myMethod(bool myBoolean, string myString, int myInt)
{
//do something..
}
通常项目中的方法是这样使用的:
myMethod("a string", an_int_number);
我想要做的是我想向所有这些方法添加一个特定的 obj.myProperty 并使它们:
myMethod(obj.myProperty,"a string", an_int_number);
基本上我需要添加相同的 obj.myProperty 作为所有名为 myMethod 的方法的第一个参数。 我不知道如何在 Visual Studio 2019 中做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.