Question

  1. Is the C# version related in any way to the targeted framework?

  2. How do I know which C# version I'm using?

  3. How can I change the C# version I'm using?

  4. What would I lose by going from .NET Framework 4 Client Profile to .NET Framework 2?

  5. Does the selected framework restrict the range of OS versions the compiled program is able to run on?

Was it helpful?

Solution

1: well, broadly; later frameworks tend to ship with later compilers; .NET included C# 2, .NET 3.5 included C# 3, .NET 4.0 for C# 4 and .NET 4.5 for C# 5

2: you can have multiple versions on your computer, and this is in part dictated by which IDE you are using, or whether you are using the command line. At the command line, csc will tell you which version it is

3: various options: use a different IDE; use a different version of csc from a different framework version; use csc with the /langversion toggle; set the "Language Version" in the "Advanced..." dialog in project properties (Visual Studio)

4: LINQ, WCF, WPF, etc - lots of bugfixes and additional framework methods / tools

5: the computer must have the required framework, sure enough...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top