C# 中的当前上下文错误中不存在名称

Name doesnot exist in the current context error in c#

我的 class 中有 2 个方法。我在 GetDb 中调用 selectAll 方法。当我在 selectAll 方法中放置一个断点时,我可以在 var all 中看到值 return。然而,当我在 GetDb 方法中查找时,var list 并未显示这些值。说实话,这也不是抛出错误。当我去快速观看时发现它说:

The name 'list' does not exist in the current context.

我在这里遗漏了什么吗?真的很感谢任何帮助..

这是我的代码:

private void GetDb()
{
     var list = selectAll();
}

public List<ticketinfo> selectAll()
{
     var all = db.ticketinfoes.Where(x => x.TaskType == "WINDOWSADMIN").ToList();
     return all;
}

在 GetDb() 方法中将列表分配给任何新变量,如 var aaa = list;现在在调试列表中应该有 vlaue.

我 运行 我的程序处于发布模式。当我将模式发布更改为调试时,它工作正常。