官术网_书友最值得收藏!

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.
主站蜘蛛池模板: 枣阳市| 莎车县| 通化市| 绥宁县| 和田市| 如皋市| 四会市| 昌都县| 福海县| 瓮安县| 垦利县| 德保县| 新余市| 东兴市| 庆云县| 泰州市| 玉田县| 天台县| 阿尔山市| 陵水| 德庆县| 北安市| 东丽区| 台东县| 湘乡市| 肥城市| 颍上县| 壶关县| 江口县| 桐梓县| 盐亭县| 沽源县| 青神县| 专栏| 衡南县| 景洪市| 时尚| 建湖县| 应城市| 江口县| 云梦县|