我的示例代码:
public partial class Service1 : ServiceBase
{
object a = new object ();
static void methodA()
{
string[] tests = {"test1","test2","test3"}
foreach(string test in tests)
{
a.SetValue(""); //object a cannot be seen
}
}
}
无法看到对象。如何在for
循环中使用对象?