Step 1: Click New Project, then select Visual C# on the left, then Windows and then select Class Library. Name your project "NugetDemo" and then click OK
Step 2: Create a simple math class
public class MyMath
{
public int Add(int a, int b)
{
return a + b;
}
public int Sub(int a, int b)
{
return a - b;
}
public decimal Div(int a, int b)
{
return (decimal)a / (decimal)b;
}
}
Step 3: Create a nuget pack as below video, then add code to play demo
class Program
{
static void Main(string[] args)
{
int a = 1;
int b = 2;
MyMath math = new MyMath();
Console.Write("a + b={0}", math.Add(a, b));
Console.WriteLine();
Console.Write("a/b={0}", math.Div(a, b));
Console.ReadKey();
}
}
VIDEO TUTORIALS