C# Version History

Version .NET Framework Visual Studio Important Features
C# 1.0 .NET Framework 1.0/1.1 Visual Studio .NET 2002 Basic features
C# 2.0 .NET Framework 2.0 Visual Studio 2005 Generics
Partial types
Anonymous   methods
Iterators
Nullable   types
Private   setters (properties)
Method   group conversions (delegates)
Covariance   and Contra-variance
Static   classes
C# 3.0 .NET Framework 3.0\3.5 Visual Studio 2008 Implicitly typed local variables
Object   and collection initializers
Auto-Implemented   properties
Anonymous   types
Extension   methods
Query   expressions
Lambda   expressions
Expression   trees
Partial Methods
C# 4.0 .NET Framework 4.0 Visual Studio 2010 Dynamic binding (late binding)
Named   and optional arguments
Generic   co- and contravariance
Embedded   interop types
C#   5.0 .NET   Framework 4.5 Visual   Studio 2012/2013 Async   features
Caller   information
C#   6.0 .NET   Framework 4.6 Visual   Studio 2013/2015 Expression   Bodied Methods
Auto-property   initializer
nameof   Expression
Primary   constructor
Await   in catch block
Exception   Filter
String   Interpolation
C# 7.0 .NET Core 2.0 Visual Studio 2017 out variables
Tuples
Discards
Pattern   Matching
Local   functions
Generalized   async return types
Expanded expression body members
C#   8.0 .NET   Core 3.0 Visual   Studio 2019 Readonly   members
Default   interface methods
Using   declarations
Static   local functions
Disposable   ref structs
Nullable   reference types
Exception   Filter
String   Interpolation
C# 9.0 .NET 5.0 Visual Studio 2019 Records
Init-only   properties
Top-level   statements
Init   accessors and readonly fields
With-expressions
Value-based   equality
Inheritance changes
C#   10.0 .NET   6.0 Visual   Studio 2022 Record   structs
Global   using directives
File-scoped   namespace declaration
Extended   Proptery Patterns
Null   Parameter Checking
Constant   interpolated strings

.NET: Roslyn Has a Missing Path

This error seems to occur when I am opening an upgraded web project in Visual Studio 2019: 
  

This happens when the current codebase is using older VS2015 templates. 

The simplest approach is to open NuGet’s Package Configuration Console in Visual Studio and enter the following to upgrade the compiler: 

Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r 
REFERENCE:  

https://stackoverflow.com/questions/32780315/could-not-find-a-part-of-the-path-bin-roslyn-csc-exe

.NET: How To Use ViewData, ViewBag And TempData in MVC

ViewData 

It is a dictionary which can contain key-value pairs where each key must be string. We can use it in transferring data from Controller to View. We can only transfer data from Controller to view but if we wish to pass data back again to controller then it is not possible. So it is valid only for the current request.

ViewBag

ViewBag is also similar to ViewData. It is used to transfer data from Controller to View. It is a type of Dynamic object, that means you can add new fields to viewbag dynamically and access these fields in the View. You need to initialize the object of viewbag at the time of creating new fields.

TempData

TempData is a dictionary object derived from TempDataDictionary. It is for subsequent HTTP requests; unlike ViewBag and ViewData, those stay only for current request. It can be used to maintain data between controller actions as well as redirects.

REFERENCES:

.NET: What Version Is On the Target Server

I’m upgrading .NET (legacy 4.*) applications on multiple unfamiliar servers.  This includes needing to know if the currently installed framework meets my requirements.  Instead of fumbling through the actual registry, I can pasted this C# snippet into a console app and all is good:

REFERENCE: https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed

C# Access Modifiers

Access Modifiers are keywords that define the accessibility of a member, class or datatype in a program. These are mainly used to restrict unwanted data manipulation by external programs or classes. There are 4 access modifiers (public, protected, internal, private) which defines the 6 accessibility levels as follows:



  • public
  • protected
  • internal
  • protected internal
  • private
  • private protected



The Accessibility table of these modifiers is given below:

public 
protected 
internal 
protected internal 
private 
private protected 
Entire program 
Yes 
No 
No 
No 
No 
No 
Containing class 
Yes 
Yes 
Yes 
Yes 
Yes 
Yes 
Current assembly 
Yes 
No 
Yes 
Yes 
No 
No 
Derived types 
Yes 
Yes 
No 
Yes 
No 
No 
Derived types within current assembly 
Yes 
Yes 
No 
Yes 
No 
Yes