代码之家  ›  专栏  ›  技术社区  ›  Ken Palmer

int.TryParse内联时无法生成Visual Studio 2017解决方案

  •  1
  • Ken Palmer  · 技术社区  · 6 年前

    int consumerID = 0;
    int.TryParse(model.TextConsumerID, out consumerID);
    

    这种模式在2017年未能建立。

    int.TryParse(model.TextConsumerID, out int consumerID);
    

    我们在应用程序的多个位置使用第一个模式。当我们按照Intellisense建议内联任何int.TryParse声明时,VisualStudio将无法生成并显示0个错误和0个警告。如果打开的类中包含其他未内联的int.TryParse命令,则会出现以下消息:“Variable declaration can be inlined。”

    应该 工作。

    0 回复  |  直到 6 年前