c# - 使用带有静态类的语句在 visual studio 2015 CTP 中不起作用

标签 c# visual-studio visual-studio-2015 c#-6.0

我为我的一个 C# 6.0 示例应用程序编写了以下代码。它在 Visual Studio 2015 预览版中运行良好。但是现在当我下载了一段时间之前发布的最新版本的 Visual Studio 2015 时。( http://blogs.msdn.com/b/bharry/archive/2015/01/16/visual-studio-2015-ctp-5-is-available.aspx ) 它停止工作了。

下面是一个代码。

using System.Console;

namespace StaticClassUsing
{
     class Program
     {
        static void Main(string[] args)
        {
              WriteLine("With using statement");
        }
     }
 }

现在,当您在最新版本的 Visual Studio 2015 中运行此应用程序时,会出现如下错误。

enter image description here

我已尝试将语言设置为 C# 6.0。 Microsoft 是否正在放弃此功能?

我们将不胜感激。

最佳答案

最近更改了语法:

使用 System.Console;

使用静态 System.Console;

参见 https://github.com/dotnet/roslyn/commit/b49f841bdeeb0b620240d2435f5a0665012f6fce

关于c# - 使用带有静态类的语句在 visual studio 2015 CTP 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28123349/

相关文章:

c# - 将许多 excel 图表作为链接粘贴到 Word

c# - System.IO.Directory.Exists() 与 Windows 和 Linux 一起使用

.net - 调试在 Dev Studio 外部构建的 .NET 程序集

c++ - 如何使用默认标题和注释设置 Visual Studio?

tfs - 带有团队资源管理器的 Visual Studio Data Tools 2015?

c# - 从 asp.net Controller 中删除 Try/Catch 语句

android - 如何用值 "No resource found that matches the given name (at ' 修复 '@integer/google_play_services_version' 值')”

VB.NET - Salesforce POST 请求返回 400 错误请求错误

ssl - 使用VS2015作为本地实例将开发ssl证书绑定(bind)到IP地址

c# - 挑战: Neater way of currying or partially applying C#4's string.加入