.NET Foundation, Future of .NET and C#

Post on 10-Feb-2017

2377 Views

Category:

Software

3 Downloads

Preview:

Click to see full reader

Transcript

.NET FoundationThe future of .NET & C#

Martin Woodward, Bertrand Le Roy

martin@dotnetfoudation.org@martinwoodwardhttp://dotnetfoundation.orghttp://github.com/dotnet

Martin Woodward

I live here

I work here

OpennessCommunityRapid innovation

The .NET Foundation .NET API for Hadoop WebClient

.NET Compiler Platform ("Roslyn").NET Map Reduce API for Hadoop

.NET Micro Framework

ASP.NET MVCASP.NET Web API

ASP.NET Web Pages

ASP.NET SignalR

MVVM Light Toolkit

.NET Core 5

Orleans

MEF (Managed Extensibility Framework)

OWIN Authentication MiddlewareRx (Reactive Extensions)

Orchard CMS Windows Azure .NET SDK

Thinktecture IdentityManagerWnsRecipe

Mimekit Xamarin.AuthXamarin.Mobile

Couchbase for .NET

Meet the people behind the .NET Foundationhttp://www.dotnetfoundation.org/team

Join the conversation with the community http://www.dotnetfoundation.org @dotnetfdn

Mailkit

System.Drawing

ASP.NET 5

Salesforce Toolkits for .NET

NuGetKudu Cecil

MSBuild

LLILC

Prism

WorldWide Telescope

Practices VisibilityMentorshipSupportGovernanceFeedback

MediaEvents

Fostering a vibrant .NET ecosystem

ProtectionLicensesCopyrightsTrademarksPatents

dotnetfoundation.org dotnet.github.io@dotnetfdn

172 repositories19,105 forks3,767 contributors

Growing daily…

Openness.Community.Rapid innovation.

.NET Foundation Support Services• CLA Automation (inc self-service admin)• Domain Registration• DNS Management• SSL Certs• Authenticode Code Signing• Secret Management• Financial Authority• Forums• Email• MSDN• Swag

.NET Innovation

Cross-Platform

Open Source

The road ahead for .NET.NET Core

ASP.NET 5

.NET 2015

.NET Framework: Windows & full BCL

.NET Core: cross-platform & open-source

.NET Framework• Windows• ASP.NET 5• ASP.NET 4.6• WPF• Windows Forms

.NET Core• Cross-platform• 100% open-source• Application-local framework• Modular, using NuGet

.NET Native• Compiled to native code• Universal Windows Platform (UWP) apps• IoT devices, Mobile, PC, Xbox, Surface Hub

.NET Cross Platform• Linux: .NET Core + VS Code + OmniSharp• OSX: .NET Core + VS Code + OmniSharp• iOS & Android: Xamarin• Windows: .NET Framework, Core, VS, VS Code,

OmniSharp

.NET Open Source• .NET Core: CoreFx and CoreCLR• Full stack of C#, VB, and F#

C# Design Process• Design meetings up to 4 times a week• Design reviews once a month• Proposals and design notes on GitHub• Prototypes for early feedback

C# Evolution

C# 1Hello World

C# 2Generics

C# 3Linq

C# 4Dynamic

C# 5Async

C# 6Boilerplate

C# 7???

Roslyn: Great for consumers• Delightful IDE experiences• Code-aware libraries• A new generation of code analysis

Roslyn: Great for extenders• Rich APIs for understanding code• Analyzer and code fix framework

Roslyn: Great for us• Written in C#• Beautiful architecture• Less duplication between layers• A lot easier to write new features

C# 6 auto-property initializerspublic string FirstName { get; set; } = "Jane";

C# 6 getter-only auto-propertiespublic string FullName { get; } = "Jane Doe";

public Person(string first, string last){ FullName = first + " " + last;}

C# 6 expression-bodied memberspublic void Print() => Console.WriteLine(FullName);public string FullName => First + " " + Last;

C# 6 using staticusing static Console;using static System.DayOfWeek;

WriteLine(Wednesday – Monday);

C# 6 null-conditional operatorsif (json?["x"]?.Type == JTokenType.Integer && json?["y"]?.Type == JTokenType.Integer){ return new Point((int)json["x"], (int) json["y"]);}return null;

C# 6 string interpolationvar s = $"http://weblogs.asp.net/{blog}/{slug}";Console.WriteLine($"({point.X}, {point.Y})");

C# 6 nameofpublic Point Add(Point point){ if (point == null) { throw new ArgumentNullException(nameof(point)); }}

C# 6 index initializersreturn new JObject { ["x"] = X, ["y"] = Y };

C# 6 exception filters & await in catchtry { … }catch (SomeException e) when (e.IsCatastrophic){ await LogAsync(e);}finally{ await CloseAsync();}

C# 7 Competition• Java• “Systems”: Go, Rust, D, …• “Functional”: F#, Scala, Erlang, Clojure, …• “Compute”: Python, R, Matlab• JavaScript• Swift

Trends to watch for C# 7• Cloud & devices• Wire data• Performance• Asynchrony

Pattern matchingif (o is Point p && p.X == 5) { WriteLine(p.Y); }

if (o is Point{ X is 5, Y is var y }) { WriteLine(y); }

if (o is Point(5, var y)) { WriteLine(y); }

Patterns with variables

Variables in scope in body

Variables in scope in rest of condition

Recursive object pattern

Positional pattern

Patterns in switch statementsswitch (o){ case string s: Console.WriteLine(s); break; case int i: Console.WriteLine($"Number {i}"); break; case Point(int x, int y): Console.WriteLine($"({x},{y})"); break; case null: Console.WriteLine("<null>"); break;}

Switch on any type

Patterns in case clauses

variables in scope only in case?

Tuple typespublic (int sum, int count) Tally(IEnumerable<int> values) { … }

var t = Tally(myValues);Console.WriteLine($"Sum: {t.sum}, count: {t.count}");

public async Task<(int sum, int count)> TallyAsync(IEnumerable<int> values) { … }

var t = await TallyAsync(myValues);Console.WriteLine($"Sum: {t.sum}, count: {t.count}");

Like parameter lists

Tuple literalspublic (int sum, int count) Tally(IEnumerable<int> values){ var s = 0; var c = 0; foreach (var value in values) { s += value; c++; } return (s, c); }

public (int sum, int count) Tally(IEnumerable<int> values){ var res = (sum: 0, count: 0); foreach (var value in values) { res.sum += value; res.count++; } return res;}

Target typed

Types and names inferred

Nullable and non-nullable reference typesstring? n; // Nullable reference typestring s; // Non-nullable reference type

n = null; // Sure; it's nullables = null; // Warning! Shouldn’t be null!s = n; // Warning! Really!

WriteLine(s.Length); // Sure; it’s not nullWriteLine(n.Length); // Warning! Could be null!if (n != null) { WriteLine(n.Length); } // Sure; you checked

Local functionsIEnumerable<T> Filter<T>(IEnumerable<T> source, Func<T, bool> predicate){ if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate));

IEnumerable<T> Iterator() { foreach (var element in source) if (predicate(element)) yield return element; } return Iterator();}

Local (nested) functionCaptured type parameters

Captured variables

Other top feature ideasShorthand “record” typesPreferably with subclassesSupport immutable records and non-destructive mutation

Extension “everything”Great partner feature to pattern matching

Typed “views” of wire dataLike TypeScript types? Like F# type providers?

Ref returns and array slicesFor performance-critical code

Async collections and streamsAsync iterators and async foreach?

top related