我有这样的课
public class foo
{
private void getThread()
{
var AllThreads = from sc in db.ScreenCycles
join s in db.Screens on sc.ScreenID equals s.ScreenID
select s;
}
}
我想让 AllThreads 变量成为类变量而不是方法变量。像这样...
public class foo
{
var AllThreads;
private void getThread()
{
AllThreads = from sc in db.ScreenCycles
join s in db.Screens on sc.ScreenID equals s.ScreenID
select s;
}
}
它不会让我声明一个 var 类型的类变量。
我该如何做到这一点?