在Visual Studio 2015 CTP中无法使用带有静态类的语句 [英] using statement with static class is not working in visual studio 2015 CTP
问题描述
我已经为我的C#6.0示例应用程序之一编写了以下代码.早期与Visual Studio 2015预览版一起使用时效果很好.但是现在我下载了一段时间之前启动的Visual Studio 2015的最新版本.(
I have written a following code for one of my C# 6.0 Sample application. It was working fine earlier with Visual Studio 2015 Preview. But now when I have downloaded the newest version of Visual Studio 2015 which launched before some time.(http://blogs.msdn.com/b/bharry/archive/2015/01/16/visual-studio-2015-ctp-5-is-available.aspx) it stopped working.
以下是该代码.
using System.Console;
namespace StaticClassUsing
{
class Program
{
static void Main(string[] args)
{
WriteLine("With using statement");
}
}
}
现在,当您在Visual Studio 2015的最新版本中运行此应用程序时,其给出的错误如下所示.
Now when you run this application in Latest Version of Visual Studio 2015 its giving error like following.
我尝试将语言设置为C#6.0. Microsoft是否正在放弃此功能?
I have tried setting up language to C# 6.0. Is Microsoft is moving away with this feature?
任何帮助将不胜感激.
推荐答案
最近在语法上进行了更改:
This was recently changed from the syntax:
using System.Console;
到
using static System.Console;
请参见 https://github.com/dotnet/roslyn/commit/b49f841bdeeb0b620240d2435f5a0665012f6fce
这篇关于在Visual Studio 2015 CTP中无法使用带有静态类的语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!