c# - 当前上下文中不存在名称 'test1'

标签 c# string visual-studio

在 MVC Controller 中,我定义了一个字符串变量,但我仍然收到消息:“当前上下文中不存在名称“test1””。

这是我的代码:

public ActionResult About()
{
  string test1;
  test1 = "A";
  return View();
}

我尝试在所有 3 个语句上放置断点,但它仅在“return”命令处停止。下面是来自 Visual Studio 2012 断点的图片:

Visual Studio Breakpoint

有什么想法吗?

最佳答案

要进行调试,请将构建配置更改为“调试”而不是“发布”。 Release 配置可以优化您的代码并防止调试器看到某些局部变量。

关于c# - 当前上下文中不存在名称 'test1',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17386591/

相关文章:

java - 在 Java 中为多种对象类型创建方法

c++ - 将数学符号存储到字符串C++中

C++ Visual Studio 错误 : Identifier cannot be implicitly captured because no default capture mode has been specified

c - 如何声明将在不同位置调用的导出函数?

c# - 如何使用 Ajax 文件上传发送防伪 token ?

c# - 检查 dbgeometry dbgeometry/dbgeography 点是否在多边形内

Python - 比较来自txt文件的字符串输入

c# - 如何在 MVC 中使用 ViewModel 进行编辑?

c# - excel 或 c# 或 SQL 解决方案来计算期间

C#/MigraDoc : Long table breaking across pages, 上下边框