.Net Standard is not a new framework. It is something simpler, but very worth to any Microsoft framework where it’s necessary share the code.
For those that already worked some time with some Microsoft frameworks, knows that developing a code that is reusable to other framework is something complicated. For example, Windows Phone 8.1 and .Net Full Framework.
That happen because each platform, or flavors, of Microsoft have its class base set. Many times one class is replicated to another platform as shown below.
Someone can say me that there is something as PCLs, Portable Class Libraries. By creating a project “Core” of type portable, it is possible selecting which frameworks will run. For example, I create a portable library that run on .Net Full Framework, Windows Phone and Xamarin. That works, but that has problem. The PCL will implement a version to each framework selected. I guess this very weird.
Do you understand the problem? The Microsoft does not have a universal library. there is something that convert to each framework. If pops up a new framework today, you will not to use this framework.
Correcting, the Microsoft did not have a universal library. Now it has the .Net Standard.
When .Net Core arrived, the Microsoft thought better and created the .Net Standard. It is not a new Framework, but an interfaces set that the frameworks must implement. That is, if the framework X and Y implement that interface, means that that code is accepted in the framework X and Y. Moreover, if a new platform pops up, as Xamarin, it just must implement this interface.
But the benefit come now, with .Net Standard, we can have Class Library that has as target to supply implementations for many platforms, .Net Core, Xamarin, .Net Framework and others. I am not using PCL. I am using interfaces.
The problem of the PCL is that it implement that code to each platform. The same code is built for all platforms that you selected. Other problem, it does not have many classes and with this could cause problem to your project. I has went through this problem when created one windows phone app.
With this image bellow, you can see that there are not a classes set for a framework, but there are frameworks above of .Net Standard.
Currently the .Net Standard is in the version 2.0 and the link show the framework versions and its implementation to .Net Standard. Each .Net Standard version specifies more interfaces. This mean that we are going to use more frameworks classes that there are not in the last version.
One analogy that the Microsoft Team uses and I like to explain about this: “The .Net Standard version is compared with HTML version and frameworks are the browsers as Chrome, IE and Firefox”. As the higher the HTML version, more features you can use. But the browser has to accept this version
The Microsoft took a long time but now created a universal interface to be used with many frameworks. Now we do not choose which frameworks we are going to use, we create a code that will be used in many frameworks.
See you later.
Did you like this article? Would you know more about .Net Core? I created a course at Udemy with a cheap price. Access https://www.udemy.com/aspnet-core-20-learn-concepts-and-creating-an-web-app