The .NET of Tomorrow
Ed Charbeneau(http://developer.telerik.com/featured/the-net-of-tomorrow/)
Exciting times lie ahead for .NET developers. During Build, Microsoft’s biggest developer event of the year, clear roadmaps were given on the future of .NET and C#. Microsoft is re-positioning .NET to be a platform that can be written anywhere and run anywhere, which is a departure from it’s long history of proprietary technologies.
Frameworks and Libraries
.NET TODAY
.NET TOMORROW
The Language of the Future is C#
ROSLYN
Conclusion
Microsoft is also reinventing itself in other ways too, like its developer tooling and the way it communicates with developers in general. This more open nature of Microsoft has even started to win over even the most skeptical of developers, such as my co-worker Cody Lindley, which you can see in his latest article, “What Has Microsoft Done For You Lately?”.
So what does all this mean for .NET developers? A well thought-out roadmap from Microsoft showing the strategy for the future of .NET. In this post, we’ll take a look at what that roadmap is.
Frameworks and Libraries
The state of .NET today is a little scattered. Restructuring projects always seem to make them worse before they get better, and this is no different. The road ahead has been a bit fuzzy since the introduction of .NET Core and perhaps got a little fuzzier with the recent announcement adding Xamarin to the mix.
While these are exciting times, they are unclear and uncertain for developers.

.NET TODAY
With the current structure of .NET, creating code that spans across different Microsoft platforms means working with portable class libraries (PCL). The PCL has shared functionality, but is very limited when compared to the .NET framework and understanding how the PCL is supported on various platforms is less than straightforward. In addition, working across the complete .NET ecosystem means working with up to three different base libraries: Base Class Library (.NET Framework), .NET Core, and Mono Class Library (Xamarin). Developer fatigue really begins to set in when trying to grasp which APIs are available for a given scenario.

.NET TOMORROW
Thankfully Microsoft understands the issue at hand and has a clear vision of how .NET things will work in the .NET of tomorrow. A big part of this strategy is to deprecate the PCL and replace it with a contract for common API support. This new contract will be called the .NET Standard Library. The .NET Standard Library will also include a specific set of reference assemblies that all .NET Platforms must support, known as the .NET Platform Standard.

The .NET Standard Library decouples the application models from the base libraries and tooling. This decoupled scenario allows for better code reuse and a shorter learning curve. Having a decoupled approach also means that the .NET Standard Library can be updated with less friction (aka breaking changes), this will mean more innovation at a faster pace. As the .NET Standard Library API surface increases with newer versions, some platforms will be left behind and become legacy. The upside is that new and yet to be created platforms have a clear foundation to build upon.
With the following table it’s easy to see that an ASP.NET Core 1.0 application has access to the full .NET Platform Standard version 1.5 APIs. In the same regard, Windows Phone 8.1 would not have access to APIs added to the standard after version 1.2.

The Language of the Future is C#
Since C# is the most popular language in .NET, it’s necessary to include it in the conversation. While C# is a very mature language, it has an exciting future as well. Much like the .NET framework, C# is being developed as an open source project. Now that C# is open source, its development will be visible to the public, including the roadmap.
Much like with the .NET Standard Library, Microsoft is promising a faster release cycle with C#. These out-of-band releases will include new language features to further enhance an already robust and mature language. In future releases we’ll see some interesting new ways for developers to write C#.
Local functions will allow functions inside of methods that will have access to variables in scope.
Tuples let functions return multiple results. The results can be named so that the code remains readable.
1: //Local function and Tuples preview
2: static void Main(string[] args)
3: {4: int[] numbers = { 1,2,3,4,5 };5:
6: // Local function
7: (int sum, int count) Tally(IEnumerable list)
8: {9: var r = (s: 0, c: 0);
10: foreach (var v in list)
11: {12: r.s += v; r.c++;
13: }
14: return r; // return Tuple of (int:sum, int:count)
15: }
16:
17: var t = Tally(numbers);
18: WriteLine($"Sum: {t.sum}, Count {t.count}"); // => Sum: 15, Count: 519:
20: }
Pattern matching extensions for C# enable many of the benefits of algebraic data types and pattern matching from functional languages, but in a way that smoothly integrates with the feel of the underlying language. Pattern matching is able to switch on the type of data and offers greater flexibility when working with non-primitive data types.
1: // pattern matching in C#
2: var people = {3: new Student("Dustin", "Campbell", 195434) { Grades = { 4.0m, 4.0m, 3.9m, 4.0m, 3.8m, 4.0m }},4: new Student("Mads", "Torgersen", 193845) { Grades = { 2.0m, 2.4m, 3.4m, 1.8m, 3.9m, 0.2m }},5: new Student("David", "Stephens", 230954) { Grades = { }},6: new Professor("Anders", "Hejlsberg", "Programming languages"),7: new Professor("Scott", "Guthrie", "Clouds"),8: new Professor("Scott", "Hunter", ".NET")9: };
10:
11: foreach (var p in people)
12: {13: if (p is Professor { Subject is var s, FirstName is "Scott"})14: {15: WriteLine($"One of the Scotts is teaching {s}");16: }
17: if (p is Student { FirstName is var n, Gpa is decimal g})18: {19: WriteLine($"{n} has a GPA of {g}:N2");20: }
21: }
Immutable objects are a feature being discussed for beyond C# 7. Immutable objects are an explicit shorthand way of writing immutable classes with the added benefit of the compiler being able to identify them as immutable.
1: // new up an immutable object
2: var p1 = new Point { X = 3, Y = 7 };3:
4: // copy p1 to p2 with an X value of negative p1's X value.
5: var p2 = p1 with { X = -p1.X }; //=> { X = -3, Y = 7 }
ROSLYN
The write anywhere run everywhere strategy of .NET is really apparent with C#. Because of Roslyn, the cross platform compiler as a service, C# can be written and run on any platform. Roslyn enables C# to run in IDEs and editors and opens the door to support from any linter, refactoring tool, and code generation tooling. In the future, expect to see more uses for C# in more places.
Conclusion
.NET is always changing and improving as a platform. Because of the sheer amount of changes happening and the speed at which they are delivered, expect some difficulties along the way. However, gone are the days of Microsoft secrecy, so enjoy the new open development process and transparent roadmaps that have been outlined. There’s an exciting future ahead for .NET, it’s cross platform, open source, and full of features one would expect from a modern set of tools and languages.
随机推荐
- Unity3d学习 相机的跟随
最近在写关于相机跟随的逻辑,其实最早接触相机跟随是在Unity官网的一个叫Roll-a-ball tutorial上,其中简单的涉及了关于相机如何跟随物体的移动而移动,如下代码: using Unit ...
- .Net多线程编程—预备知识
1 基本概念 共享内存的多核架构:一个单独的封装包内封装了多个互相连接的未处理器,且所有内核都可以访问主内存.共享内存的多核系统的一些微架构,例如内核暂停功能,超频. 内核暂停功能:当使用内核不多的时 ...
- ExtJS 4.2 业务开发(三)数据添加和修改
接上面的船舶管理业务,这里介绍添加和修改操作. 目录 1. 添加操作 2. 修改操作 3. 在线演示 1. 添加操作 1.1 创建AddShipWindow.js 在业务中的view目录下创建一个Ad ...
- PowerShell过滤文件中的重复内容
Get-Content -Path E:\test11\data.txt | Sort-Object | Get-Unique 源文件: AA0001 2014-06-30 15:27:13.073 ...
- 如何进行python性能分析?
在分析python代码性能瓶颈,但又不想修改源代码的时候,ipython shell以及第三方库提供了很多扩展工具,可以不用在代码里面加上统计性能的装饰器,也能很方便直观的分析代码性能.下面以我自己实 ...
- 46张PPT讲述JVM体系结构、GC算法和调优
本PPT从JVM体系结构概述.GC算法.Hotspot内存管理.Hotspot垃圾回收器.调优和监控工具六大方面进行讲述.(内嵌iframe,建议使用电脑浏览) 好东西当然要分享,PPT已上传可供下载 ...
- 用scikit-learn学习谱聚类
在谱聚类(spectral clustering)原理总结中,我们对谱聚类的原理做了总结.这里我们就对scikit-learn中谱聚类的使用做一个总结. 1. scikit-learn谱聚类概述 在s ...
- 星浩资本快速发展引擎:IT就是生产力
星浩资本成立于2010年,是一家涵盖私募基金.开发管理.商业与现代服务业三大业务范围的综合性管理公司,专注于投资中国首创.高成长性.高回报率的创新型城市综合体. 年轻的星浩资本在商业投资上有其独到的商 ...
- 打破陈规抓痛点,H3 BPM10.0挑战不可能
高效益意味着相似的运营活动比竞争对手做得更好,而战略定位则意味着企业在运营活动中有区别于竞争对手的实施方式,即差异化竞争.在新经济体下,面对社会的变革.市场的竞争环境.不断攀升的成本压力,几乎没有企业 ...
- Android之SAX解析XML
一.SAX解析方法介绍 SAX(Simple API for XML)是一个解析速度快并且占用内存少的XML解析器,非常适合用于Android等移动设备. SAX解析器是一种基于事件的解析器,事件驱动 ...