问题
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.
Following is a code for that.
using System.Console;
namespace StaticClassUsing
{
class Program
{
static void Main(string[] args)
{
WriteLine("With using statement");
}
}
}
Now when you run this application in Latest Version of Visual Studio 2015 its giving error like following.
I have tried setting up language to C# 6.0. Is Microsoft is moving away with this feature?
Any help will be appreciated.
回答1:
This was recently changed from the syntax:
using System.Console;
to
using static System.Console;
See https://github.com/dotnet/roslyn/commit/b49f841bdeeb0b620240d2435f5a0665012f6fce
来源:https://stackoverflow.com/questions/28123349/using-statement-with-static-class-is-not-working-in-visual-studio-2015-ctp