Hello! Today we will look at the various chips and changes that appeared in the .NET Core platform and compare them with the Framework. I broke the article into modules for better understanding. This article will be interesting to those who are going to switch to .NET Core or are already using it.
Stack technology
We currently have three platforms: .NET Framework, Mono, and .NET Core. Each platform includes the following technologies:
NET Framework - WPF, WinForms, ASP.NET (DNX implementation), WCF
NET Core - UWP, ASP.NET Core, WA, Xamarin (.NET Standard), Avalonia and other
Mono - Xamarin (PCL, Share project), Unity, ASP.NET, WinForms (cross platform)
NET Core (3.0) - Everything is the same as in .NET Core above + WPF and WinForms, ML.NET
')
NET Standard
There is also a .NET Standard. This is a set of classes, methods and interfaces that allow you to write and use common code for all the platforms listed above. You can also write console applications on it. In short, this is the same PCL, but it works on all the platforms listed above.
Cross platform
I will not draw your attention to this, I will simply list the OS support for NET Core projects:
• Windows
• Linux
• MacOS
Additionally, it supports running under ARM processors on Linux and Windows.
Dependency
As part of cross-compatibility, the application development platform includes a modular infrastructure. It is issued via NuGet, and you can access the batch functions, rather than one large assembly. As a developer, you can create lightweight applications that contain only the necessary NuGet packages, which will make your program safer and more productive.
The modular infrastructure also makes it possible to update the .NET Core platform faster, since the affected modules can be updated and released separately.
Csproj
Now let's dive in and see in more detail what is under the hood in our projects. When creating a new project, each of you came across a file MyProject1.csproj (the name may differ). This file is responsible for the compilation settings of this project, dependencies of other projects or libs (libraries) and much more.
I have an example for you of how I decided to rewrite one project on .NET Standard. Let's take a look how it was before (Framework):

Unfortunately on my PC, this file does not fit completely (there are still references). And now let's see how it became after the transfer:

In NET Core and .NET Standard, csproj has been greatly simplified. Particularly "ballistic" may notice that little has changed. I removed the unnecessary and replaced with more convenient tools. After rewriting csproj, I noticed that working with NuGet packages began to take noticeably less time and as you understand, it is more convenient to edit the new version of csproj, because it is not cluttered with unnecessary lines.
Performance & Improvements
• Modified Random
• Modified HttpClient
• Optimized cycles
• Optimized List, Array
• Optimized Stream, MemoryStream
• And much more
In this article I will not consider all the changes. This will be a separate article. But let's look at a small example on the List collection:
var list = new List<int>(); for (int i = 0; i < 100000000; i++) { list.Add(i); list.RemoveAt(0); }
I drove it through
benchmarkdotnet.org on both platforms. After the tests, I got the following results:
Core 2.2.4 x64 RyuJITMethod : BenchmarkList
Mean : 370.1 ms
Error : 0.3761 ms
StdDev : 0.3518 ms
Framework 4.7.2 x64 RyuJITMethod : BenchmarkList
Mean : 481.9 ms
Error : 1.210 ms
StdDev : 1.011 ms
As you can see, the speed of work is significantly different (at times) in favor of the Core.
Microsoft is trying not only to give developers convenient development tools, but also improves the basic things that lead to improvements and optimization of your projects.
Tier compilation
This is a feature that makes the runtime more adaptively using the JIT compiler to improve startup performance and maximize throughput.
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.2</TargetFramework> <LangVersion>7.3</LangVersion> <TieredCompilation>true</TieredCompilation> <Platforms>AnyCPU;x64</Platforms> </PropertyGroup> </Project>
Compiles a project as quickly as possible.
Optimizes the most common methods.
This functionality leads to the fact that your project is going faster and gives you almost the same performance. We tested this functionality, and this is a smart feature for NET Core projects, which reduces compile time. Multi-level compilation slightly slows down your application, I do not advise to enable it on the production server, but for debugging there is more than an actual function that saves programmers time.
Conclusion
Microsoft is trying to improve the lives of developers. NET platform. All the listed “buns” that have appeared in our company allow us to make the environment more open and expandable. Hope you appreciate it. Do not be afraid to switch to a new technology stack and use different features.
Thanks for attention. Hope you enjoyed it.