Reputation: 10527
I've just installed .NET Core 1.0 and run the sample hello world.
Upvotes: 4
Views: 2396
Reputation: 2664
The difference is more between .Net Core
and the full .Net Framework
, Meaning, you'll be able to use the same syntax, but you'll find differences in the classes you can/can't use and sometimes, in the way you use them.
Upvotes: 1
Reputation: 22747
.NET Core 1.0 ships with C# 6. You can see that in the references:
Microsoft.CodeAnalysis
* are the NuGet packages for the C# compiler. Versions 1.x correspond to C# 6, and 2.x (currently in beta) are C# 7.
You can also see this dependency on NuGet: Microsoft.NETCore.App.
When C# 7 comes out, it would probably be possible to use the new compiler by adding its package to a .NET Core project.
Upvotes: 5
Reputation: 1503599
The language itself isn't generally tied to a specific runtime/framework, although some language features do require framework features. (For example, interpolated strings are a bit more flexible on .NET 4.6 than on .NET 2.0 due to the presence of FormattableString
.) However, there are two things to consider:
dotnet cli
)The SDK supports C# 6 out of the box. I would personally expect the C# 7 version of the Roslyn packages to support .NET Core as well (e.g. targeting netstandard1.5
), so code that compiles more code at execution time should be fine on that front. I don't know what the plan is in terms of tying compiler versions to SDK versions - I suspect that will become clearer when the project.json to msbuild transition is complete.
I don't know of any way of determining what language version a particular SDK supports out of the box - it would be reasonably easy to come up with a sequence of small classes which exercise particular language features and see if they compile, of course. Trickier would be to come up with code that builds with multiple versions but gives different results; there are ways of doing that between consecutive language versions (at least 2-3, 3-4, 4-5... not sure about 5-6) but they're slightly more convoluted.
Upvotes: 4