When people uses term .NET, it greatly depends on the context. There is a distinction between C# and .NET as C# is a programing language syntax that can be used to reference and call methods defined in .NET code libraries or assemblies. We can create an assembly from our C# code and use it’s compiler that’s installed with .NET SDK.
.Net standard library can target a number of different platforms. for example, Android, iOS, Linux, Windows etc so In this blog post, We will create a dotnet standard library in an easy way. It will be a very standard class library to demo something. This library will contain two super helpful methods. One method adds two number together and other subtracts one number from the other.
Create a dotnet Standard Library
Prerequisites
- Visual Studio 2019 (If you are following along this blog post)
Figure 8 – Class named as Calculate
Let’s Start some coding!
Code Snippet
using System; using System.Collections.Generic; using System.Text; namespace ACloudTechie.Artifact.Calculate { public class Calculator { public static double Add(double numOne, double numTwo) { return numOne + numTwo; } public static double Subtract(double numOne, double numTwo) { return numOne - numTwo; } } }