Wednesday, 7 January 2015

New Toys

Looks like there has been a load of new stuff for Visual Studio and .NET Recently. So I thought I would have a play. Link.

Visual Studio Ultimate 2015 Preview
Download and installation pretty standard, havent noticed anything exceptionally different, lambda debugging looks like it will be pretty cool. Will spend a bit more time playing with the features after I have played with C#6.
List of features

Roslyn (The new C# compiler platform)
Pretty easy to install in to a project just put open a console and type:
Install-Package Microsoft.CodeAnalysis -Pre
Roslyn Website

R#
New platform installer for 9.1 picked up vs2015 and installed, works fine. Looks like some of the c# 6 support is already added as it suggests adding the ?. (Null Propagation) operator.
Resharper Platform Installer

C# 6
Tried out some of the new features including Null propagation, using Static Members ,auto Property Initializers,Getter only auto properties,Exception Filters. Lots of fun :) hopefully will have time to look at a few of these more in depth.

Here is a list of c#6 features:
















FeatureExampleC#VB
Auto-property initializerspublic int X { get; set; } = x;AddedExists
Getter-only auto-propertiespublic int Y { get; } = y;AddedAdded
Ctor assignment to getter-only autopropsY = 15AddedAdded
Parameterless struct ctorsStructure S : Sub New() : End Sub : End StructureAddedAdded
Using static membersusing System.Console; … Write(4);AddedExists
Dictionary initializernew JObject { ["x"] = 3, ["y"] = 7 }AddedNo
Await in catch/finallytry … catch { await … } finally { await … }AddedNo
Exception filterscatch(E e) if (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
Line continuation commentsDim addrs = From c in Customers ' commentN/AAdded
TypeOf IsNotIf TypeOf x IsNot Customer Then …N/AAdded
Expression-bodied memberspublic double Dist => Sqrt(X * X + Y * Y);AddedNo
Null propagationcustomer?.Orders?[5]?.$priceAddedAdded
String interpolation$"{p.First} {p.Lastis {p.Ageyears old."Added*Planned
nameof operatorstring s = nameof(Console.Write);Added*Planned
#pragma#Disable Warning BC40008AddedAdded
Smart name resolutionN/AAdded
ReadWrite props can implement ReadOnlyExistsAdded
#region inside methodsExistsAdded
Overloads inferred from OverridesN/AAdded
CObj in attributesExistsAdded
CRef and parameter nameExistsAdded
Extension Add in collection initializersAddedExists
Improved overload resolutionAddedN/A
Source

Xamarin
At first the Xamarin project templates did not appear, but I updated Xamarin studio to v 3.9 (In the alpha/Beta Channel) which features Visual Studio 2015 support and the templates appeared.

Looks like there is lots of fun ahead for .net!

No comments:

Post a Comment