opened
TheManii
username_0
## Summary

Update the C# support for the latest compilers included out of the box in the net framework
## Details

Added details for C# 4 though C# 7 (the latest version as of this PR)

As of net 4.7 (also the latest as of this PR), the legacy version of csc (and the codedomprovider it uses by default) included in it can only handle C# 5 syntax (and older). 

Anything above C# 5 requires using the roslyn compiler, which is not included out of the box in any version of the net framework. The roslyn based version of csc is located in a different file path then the one listed here: [Command-line build with csc.exe](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/command-line-building-with-csc-exe) when installed globally as part of VS2017

Due to this, unless there is specific references to VS 2017+ (which uses roslyn by default) or manually adding roslyn to a project as the compiler, I assume that we are talking about the legacy csc compiler.
Clarified C# language support for the compiler
issue
created
svick
username_1
That page also first talks about the Developer Command Prompt for Visual Studio, which does include the Roslyn-based version of `csc`.

Maybe the reference to the `Microsoft.NET\Framework` directory should be updated there?
comment
created
TheManii
username_0
While yes it's very ugly to need to mention the net framework version, ms didn't ship csc independent of the net framework it's associated with.  Even though you necessarily don't need the newest net framework to run something written the newest c#, you would still need the newest framework to compile it if you're doing so via the globally installed csc. (well until c# 6/7 happened) 

The topic this page is part of doesn't explicitly mention which exact compiler/csc it's talking about, but the legacy net compilers has the largest install base (since it's installed by default in windows). Roslyn is included as a link and not directly on the page as the other pages in this topic do not outright say you need to install additional and separate software to use it. 

---------------------------

It's very much possible to exclusively use notepad (or any other text editor) and compile manually with the out-of-the-box csc. You simply have to know a lot of things ahead of time in this case, the changes I propose slightly reduce that load.

If you're using powershell (like I am) to compile *.cs files with add-type, you may not even be aware at all of any of the details on the underlying msbuild/csc details until you start using features not available in your compiler. At least with powershell, it'll simply fill in the details on the compiler options, all you need is valid c# syntax up to that point. This is pretty much exactly what I needed to know (and not much more beyond that) with regards to compiling c# 6+ with powershell (which is: I can't, I need roslyn)
comment
created
GuardRex
username_2
@username_0 I've added the WIP label. Just ping back when you're ready for review.
comment
created
svick
username_1
Yes, but I don't see how that's relevant here. The details about what version of the framework do you need for each new feature (and which NuGet package can you use instead) can be complicated. I have [a Stack Overflow answer](https://stackoverflow.com/a/42488315/41071) going though the features of C# 7.0, but I don't think that information belongs here.
comment
created
TheManii
username_0
Other pages do have some info, at least this example means that it was likely C# 5 (as that's that VS2012 is associated with on wikipedia at least) for compiling, but nothing explicitly on running.

I'm definitely going to reword the first paragraph at the minimum, but my concern of "which runtime do I need to use feature X?" still isnt covered yet. Having to consult the release notes, manually testing each individual feature, or consulting stackoverflow does somewhat defeat the purpose of a c# guide when it should be clearly spelled out like the net api docs do.

Your own stackoverflow answer pretty much says what I'm thinking, that runtime support on specific features are not monolithic, some are 4.0+ minimum, and some are 4.5+ minimum for c# 7 constructs. 

I'm simply not in a position to update the entire keyword list for minimum version supported since it requires testing, reading though the compiler/runtime source, or each individual feature's source or release notes (if they have any) to see what the actual minimum runtimes are. (There's also stuff like valuetuple which is a construct and has no new keywords, yet is released as part of the language)
comment
created
BillWagner
username_3
@username_0  Thanks for the work on this topic. It will help quite a bit with clarity regarding language features, libraries, and frameworks. We realize there is a long way to go, and a lot to explain.

First, regarding this PR, is it ready for a final review? Should I remove the "WIP" label? 

Second, some of the concerns you mention are also called out in issue #1760 I'll be working on that topic this month, and I'd like your input as that content gets developed. 

Let me know if I should carefully review what you've done here and merge it when we've finished that review.
comment
created
TheManii
username_0
I'm no longer working on it, you can use it as-is or take it and expand on it yourself. I consider it complete as far as explaining the csc <-> c# <-> clr dependencies as much as a general lay developer would need.

I'll mention my opinions on the dependencies on #1760 so it's more visible and relevent
comment