How to do it...

  1. Open Visual Studio 2017.
  2. Click File | New | Project.
  3. Now, in the New Project dialog box, expand the Visual C# node in the left-hand pane and select Class Library .NET Standard, and in the right-hand pane, select Class Library (.NET Standard)
  1. In the Name: text box, type a name for your class library. Let's type Chapter1.StandardLib.HelloUniverse and select a preferred location under the Location: drop-down list, or click the Browse... button and select a location. Leave the defaults as they are. Finally, in the Solution name: text box, type Chapter1.StandardLib
  1. Click OK.
  1. In the Solution Explorer (press Ctrl + Alt + L) , click on Class1.cs, press F2, and rename it HelloUniverse.cs. Confirm the renaming by selecting Yes in the confirmation box.  
  2. Change the namespace from Chapter1.StandardLib.HelloUniverse to Chapter1.StandardLib.
  3. Now, in between the curly brackets of the HelloUniverse class, type the following code: 
      public string SayHello(string name)
{
return $"Hello {name},
welcome to a whole new Universe of .NET Standard 2.0";

}
  1. Press Ctrl + S to save the changes and press Ctrl + Shift + B to build the code. If the build completes without any errors, we are good to go with the next recipe on how to use this class library.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.210.17