Back to Roslyn

Languages Features In C# 6 And VB 14

docs/wiki/Languages-features-in-C#-6-and-VB-14.md

11.0.1002.6 KB
Original Source
  • Exists: Already shipped in previous release
  • Added: Implemented for this release
  • Planned: Intended for this release
  • No: Not intended for this release
  • N/A: Not meaningful for this language

Please note that everything is still subject to change - this is a preview after all. However, we are reasonably confident about the overall feature set at this point.

Visual Studio 2015 RC has the following features. For a description of each feature see:

FeatureExampleC#VB
Auto-property initializerspublic int X { get; set; } = x;AddedExists
Read-only auto-propertiespublic int Y { get; } = y;AddedAdded
Ctor assignment to getter-only autopropsY = 15AddedAdded
Static importsusing static System.Console; … Write(4);AddedExists
Index initializernew JObject { ["x"] = 3 }AddedNo
Await in catch/finallytry … catch { await … } finally { await … }AddedNo
Exception filterscatch(E e) when (e.Count > 5) { … }AddedExists
Partial modulesPartial Module M1N/AAdded
Partial interfacesPartial Interface I1ExistsAdded
Multiline string literals"Hello<newline>World"ExistsAdded
Year-first date literalsDim d = #2014-04-03#N/AAdded
Comments after implicit line continuationDim addrs = From c in Customers ' commentN/AAdded
TypeOf ... IsNot ...If TypeOf x IsNot Customer Then …N/AAdded
Expression-bodied memberspublic double Dist => Sqrt(X * X + Y * Y);AddedNo
Null-conditional operatorscustomer?.Orders?[5]AddedAdded
String interpolation$"{p.Name} is {p.Age} years old."AddedAdded
nameof operatorstring s = nameof(Console.Write);AddedAdded
#pragma#Disable Warning BC40008AddedAdded
Smart name resolutionN/AAdded
Read-write props can implement read-only interface propertiesExistsAdded
#Region inside methodsExistsAdded
Overloads inferred from OverridesN/AAdded
CObj in attributesExistsAdded
CRef and parameter nameExistsAdded
Extension Add in collection initializersAddedExists
Improved overload resolutionAddedN/A