Coding For a Living

rss

A place to share and comment about coding for a living.


Possible Features of C#.6 and VB.12 Mike McIntyre

Below are some features that may be a part of C#.6 and VB.12.  For current information visit Language feature implementation status for Dev14

Feature status as of 10/3/2014:

Feature

Example

C#

VB

Primary constructors

class Point(int x, int y) { … }

No

No

Auto-property initializers

public int X { get; set; } = x;

Done

Exists

Getter-only auto-properties

public int Y { get; } = y;

Done

Done

Ctor assignment to getter-only autoprops

Y = 15

Done

Done

Parameterless struct ctors

Structure S : Sub New() : End Sub : End Structure

Done

Done

Using static members

using System.Console; … Write(4);

Done

Exists

Dictionary initializer

new JObject { ["x"] = 3, ["y"] = 7 }

Done

No

Indexed member initializer

new JObject { $x = 3, $y = 7 }

No

No

Indexed member access

c.$name = c.$first + " " + c.$last;

No

Exists

Declaration expressions

int.TryParse(s, out var x);

No

No

Await in catch/finally

try … catch { await … } finally { await … }

Done

Maybe

Exception filters

catch(E e) if (e.Count > 5) { … }

Done

Exists

Typecase

Select Case o : Case s As String : …

No

Maybe

Guarded cases

Select Case i : Case Is > 0 When i Mod 2 = 0

No

No

Partial modules

Partial Module M1

N/A

Done

Partial interfaces

Partial Interface I1

Exists

Done

Multiline string literals

"HelloWorld"

Exists

Done

Year-first date literals

Dim d = #2014-04-03#

N/A

Done

Binary literals

0b00000100

No

No

Digit separators

0xEF_FF_00_A0

No

No

Line continuation comments

Dim addrs = From c in Customers ' comment

N/A

Done

TypeOf IsNot

If TypeOf x IsNot Customer Then …

N/A

Done

Expression-bodied members

public double Dist => Sqrt(X * X + Y * Y);

Done

No

Event initializers

new Customer { Notify += MyHandler };

No

No

Null propagation

customer?.Orders?[5]?.$price

Done

Planned

Semicolon operator

(var x = Foo(); Write(x); x * x)

No

No

Private protected

private protected string GetId() { … }

No

No

Params IEnumerable

int Avg(params IEnumerable numbers) { … }

Maybe

Maybe

Constructor Inference

new Tuple(3, "three", true);

No

No

String interpolation

"\{p.First} \{p.Last} is \{p.Age} years old."

Planned

Planned

TryCast for nullable

Dim x = TryCast(u, Integer?)

Exists

No

Delegate combination with +

d1 += d2

Exists

No

Implicit implementation

Class C : Implicitly Implements I

Exists

No

nameof operator

string s = nameof(Console.Write);

Done

Planned

Strict modules

Strict Module M

Exists

No

Faster CInt

Dim x = CInt(Math.Truncate(d)) |

Exists

No

#pragma

#Disable Warning BC40008

Done

Done

Checked and Unchecked blocks

Checked : x += 1 : End Checked

Exists

No

Field targets on autoprops

Serializable> Property p As Integer

Maybe

Maybe

If(b,e1,e2) uses type context

Dim x As Integer? = If(b,1,Nothing)

N/A

No