.NET Foundation
The future of .NET & C#
Martin Woodward, Bertrand Le Roy
martin@dotnetfoudation.org
@martinwoodward
http://dotnetfoundation.org
http://github.com/dotnet
Martin Woodward
I live here
I work here
The .NET Foundation
.NET API for Hadoop WebClient
.NET Compiler Platform ("Roslyn")
.NET Map Reduce API for Hadoop
.NET Micro Framework
ASP.NET MVC
ASP.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 IdentityManager
WnsRecipe
Mimekit Xamarin.Auth
Xamarin.Mobile
Couchbase for .NET
Meet the people behind the .NET Foundation
http://www.dotnetfoundation.org/teamhttp://www.dotnetfoundation.org
@dotnetfdn
Mailkit
System.Drawing
ASP.NET 5
Salesforce Toolkits for .NET
NuGetKudu
Cecil
MSBuild
LLILC
Prism
WorldWide Telescope
Microsoft Confidential
Practices Visibility
Mentorship
Support
Governance
Feedback
Media
Events
Fostering a vibrant .NET ecosystem
Protection
Licenses
Copyrights
Trademarks
Patents
dotnetfoundation.org
dotnet.github.io
@dotnetfdn
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
Microsoft Confidential
.NET Innovation Cross-PlatformOpen 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# 1
Hello World
C# 2
Generics
C# 3
Linq
C# 4
Dynamic
C# 5
Async
C# 6
Boilerplate
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 initializers
public string FirstName { get; set; } = "Jane";
C# 6 getter-only auto-properties
public string FullName { get; } = "Jane Doe";
public Person(string first, string last)
{
FullName = first + " " + last;
}
C# 6 expression-bodied members
public void Print() => Console.WriteLine(FullName);
public string FullName => First + " " + Last;
C# 6 using static
using static Console;
using static System.DayOfWeek;
WriteLine(Wednesday – Monday);
C# 6 null-conditional operators
if (json?["x"]?.Type == JTokenType.Integer &&
json?["y"]?.Type == JTokenType.Integer)
{
return new Point((int)json["x"], (int) json["y"]);
}
return null;
C# 6 string interpolation
var s = $"http://weblogs.asp.net/{blog}/{slug}";
Console.WriteLine($"({point.X}, {point.Y})");
C# 6 nameof
public Point Add(Point point)
{
if (point == null)
{
throw new ArgumentNullException(nameof(point));
}
}
C# 6 index initializers
return new JObject { ["x"] = X, ["y"] = Y };
C# 6 exception filters & await in catch
try { … }
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 matching
if (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 in switch statements
switch (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;
}
Tuple types
public (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}");
Tuple literals
public (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;
}
Nullable and non-nullable reference types
string? n; // Nullable reference type
string s; // Non-nullable reference type
n = null; // Sure; it's nullable
s = null; // Warning! Shouldn’t be null!
s = n; // Warning! Really!
WriteLine(s.Length); // Sure; it’s not null
WriteLine(n.Length); // Warning! Could be null!
if (n != null) { WriteLine(n.Length); } // Sure; you checked
Local functions
IEnumerable<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();
}
Other top feature ideas
Shorthand “record” types
Preferably with subclasses
Support immutable records and non-destructive mutation
Extension “everything”
Great partner feature to pattern matching
Typed “views” of wire data
Like TypeScript types? Like F# type providers?
Ref returns and array slices
For performance-critical code
Async collections and streams
Async iterators and async foreach?

.NET Foundation, Future of .NET and C#

  • 1.
    .NET Foundation The futureof .NET & C# Martin Woodward, Bertrand Le Roy
  • 3.
  • 4.
  • 5.
  • 8.
    The .NET Foundation .NETAPI for Hadoop WebClient .NET Compiler Platform ("Roslyn") .NET Map Reduce API for Hadoop .NET Micro Framework ASP.NET MVC ASP.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 IdentityManager WnsRecipe Mimekit Xamarin.Auth Xamarin.Mobile Couchbase for .NET Meet the people behind the .NET Foundation http://www.dotnetfoundation.org/teamhttp://www.dotnetfoundation.org @dotnetfdn Mailkit System.Drawing ASP.NET 5 Salesforce Toolkits for .NET NuGetKudu Cecil MSBuild LLILC Prism WorldWide Telescope Microsoft Confidential
  • 9.
    Practices Visibility Mentorship Support Governance Feedback Media Events Fostering avibrant .NET ecosystem Protection Licenses Copyrights Trademarks Patents dotnetfoundation.org dotnet.github.io @dotnetfdn Openness. Community. Rapid innovation.
  • 10.
    .NET Foundation SupportServices • CLA Automation (inc self-service admin) • Domain Registration • DNS Management • SSL Certs • Authenticode Code Signing • Secret Management • Financial Authority • Forums • Email • MSDN • Swag
  • 13.
  • 14.
    .NET Innovation Cross-PlatformOpenSource The road ahead for .NET .NET Core ASP.NET 5
  • 15.
    .NET 2015 .NET Framework:Windows & full BCL .NET Core: cross-platform & open-source
  • 16.
    .NET Framework • Windows •ASP.NET 5 • ASP.NET 4.6 • WPF • Windows Forms
  • 17.
    .NET Core • Cross-platform •100% open-source • Application-local framework • Modular, using NuGet
  • 18.
    .NET Native • Compiledto native code • Universal Windows Platform (UWP) apps • IoT devices, Mobile, PC, Xbox, Surface Hub
  • 19.
    .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
  • 20.
    .NET Open Source •.NET Core: CoreFx and CoreCLR • Full stack of C#, VB, and F#
  • 21.
    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
  • 22.
    C# Evolution C# 1 HelloWorld C# 2 Generics C# 3 Linq C# 4 Dynamic C# 5 Async C# 6 Boilerplate C# 7 ???
  • 23.
    Roslyn: Great forconsumers • Delightful IDE experiences • Code-aware libraries • A new generation of code analysis
  • 24.
    Roslyn: Great forextenders • Rich APIs for understanding code • Analyzer and code fix framework
  • 25.
    Roslyn: Great forus • Written in C# • Beautiful architecture • Less duplication between layers • A lot easier to write new features
  • 26.
    C# 6 auto-propertyinitializers public string FirstName { get; set; } = "Jane";
  • 27.
    C# 6 getter-onlyauto-properties public string FullName { get; } = "Jane Doe"; public Person(string first, string last) { FullName = first + " " + last; }
  • 28.
    C# 6 expression-bodiedmembers public void Print() => Console.WriteLine(FullName); public string FullName => First + " " + Last;
  • 29.
    C# 6 usingstatic using static Console; using static System.DayOfWeek; WriteLine(Wednesday – Monday);
  • 30.
    C# 6 null-conditionaloperators if (json?["x"]?.Type == JTokenType.Integer && json?["y"]?.Type == JTokenType.Integer) { return new Point((int)json["x"], (int) json["y"]); } return null;
  • 31.
    C# 6 stringinterpolation var s = $"http://weblogs.asp.net/{blog}/{slug}"; Console.WriteLine($"({point.X}, {point.Y})");
  • 32.
    C# 6 nameof publicPoint Add(Point point) { if (point == null) { throw new ArgumentNullException(nameof(point)); } }
  • 33.
    C# 6 indexinitializers return new JObject { ["x"] = X, ["y"] = Y };
  • 34.
    C# 6 exceptionfilters & await in catch try { … } catch (SomeException e) when (e.IsCatastrophic) { await LogAsync(e); } finally { await CloseAsync(); }
  • 35.
    C# 7 Competition •Java • “Systems”: Go, Rust, D, … • “Functional”: F#, Scala, Erlang, Clojure, … • “Compute”: Python, R, Matlab • JavaScript • Swift
  • 36.
    Trends to watchfor C# 7 • Cloud & devices • Wire data • Performance • Asynchrony
  • 37.
    Pattern matching if (ois 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); }
  • 38.
    Patterns in switchstatements switch (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; }
  • 39.
    Tuple types public (intsum, 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}");
  • 40.
    Tuple literals public (intsum, 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; }
  • 41.
    Nullable and non-nullablereference types string? n; // Nullable reference type string s; // Non-nullable reference type n = null; // Sure; it's nullable s = null; // Warning! Shouldn’t be null! s = n; // Warning! Really! WriteLine(s.Length); // Sure; it’s not null WriteLine(n.Length); // Warning! Could be null! if (n != null) { WriteLine(n.Length); } // Sure; you checked
  • 42.
    Local functions IEnumerable<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(); }
  • 43.
    Other top featureideas Shorthand “record” types Preferably with subclasses Support immutable records and non-destructive mutation Extension “everything” Great partner feature to pattern matching Typed “views” of wire data Like TypeScript types? Like F# type providers? Ref returns and array slices For performance-critical code Async collections and streams Async iterators and async foreach?

Editor's Notes

  • #9 Description (“what is the .NET Foundation”) The .NET Foundation is an independent organization created to foster open development and collaboration around the growing collection of open source technologies for.NET. It will serve as a forum for commercial and community developers alike with a set of practices and processes that strengthen the future of the .NET ecosystem. Story telling (“why the .NET Foundation”) Three years ago we announced how some key components of .NET such as ASP.NET MVC or Entity Framework embraced a new development process that was more transparent, open, and community driven. Since then, we have only received great feedback from you. Increasing our investments in .NET, while opening the process to the community has allowed .NET to innovate faster with feedback and contributions. With the .NET Foundation we want to extend this new development model to be the norm for .NET and not the exception. We want to make sure that .NET projects (both from Microsoft and from other companies and individual contributors) have a place that provides the mechanisms to promote the openness, community participation and rapid innovation to build the next generation of the .NET ecosystem. There are currently 31 projects and 81 repositories in the .NET Foundation. http://www.dotnetfoundation.org/projects
  • #10 Check dotnet.github.io for up to date stats and update slide! .NET Foundation foster openness, community and rapid innovation around .NET by providing legal protection, open practices & support as well as visibility to projects. The frameworks for these pillars will be defined by the advisory council and board of directors. Messaging pillars (“what are the top three things I need to know about the .NET Foundation”) It opens the development process for .NET: The .NET Foundation brings into one common umbrella existing and new relevant open source projects for the .NET platform, such as .NET Core, ASP.NET and .NET Compiler Platform (“Roslyn”). The .NET Foundation will provide the frame for making this the norm moving forward, so more and more components and libraries of .NET are using an open process that is transparent and welcomes your participation. It encourages customers, partners and the broader community to participate: The .NET Foundation will foster the involvement and direct code contributions from the community, both through its board members as well as directly from individual developers, through an open and transparent governance model that strengthens the future of .NET. It promotes innovation by a vibrant partner ecosystem and open source community: The .NET Foundation will promote commercial partners and open source developers to build solutions that leverage the platform openness to provide additional innovation to .NET developers. This includes extending .NET to other platforms, extending Visual Studio to create new experiences, providing additional tools or extending the framework and libraries with new capabilities. Call to action: Join the conversation We are in the process of defining the advisory council with the community and getting the .NET Foundation activities off the ground. We’ve been taking feedback from the community from the start. Join the conversation on our forums at forums.dotnetfoundation.org. Meet the team behind the foundation at dotnetfoundation.org/team
  • #20 https://msdn.microsoft.com/library/windows/apps/dn894631.aspx
  • #28 Initializers for auto-properties
  • #29 Getter-only auto-properties (can also be set from the constructor)
  • #30 Expression-bodied methods and properties
  • #31 Using static
  • #32 Null-conditional
  • #33 String interpolation Expressions, full IntelliSense & refactoring support in the holes.
  • #34 Nameof
  • #35 Index initializers
  • #36 Exception filters & await in catch and finally
  • #37 Java: somewhat uncool, great ecosystem, evolving again “Systems”: performance-productivity-reliability triangle “Functional”: Decidedly cool, and on the right side of history, but also elitist “Compute”: captures lots of cloud cycles JavaScript: it’s everywhere, getting better, and is helped by TypeScript Swift: captive audience, mainstreaming advanced features, has lots of mindshare
  • #38 Wire data: untyped, semi-structured; translating to strong types is expensive and lossy; bad match for OO: functions are not on the inside of the objects. Perf: devices get smaller; in the cloud, time and space are money Async: latency must be taken into account; current model deals with single values, not with collections that can be asynchronously enumerated