- .NET Standard 2.0 Cookbook
- Fiqri Ismail
- 217字
- 2021-06-25 22:11:33
How to do it...
- Open Visual Studio 2017.
- Click File | New | Project.
- 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):

- 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.

- Click OK.
- 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.
- Change the namespace from Chapter1.StandardLib.HelloUniverse to Chapter1.StandardLib.
- 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";
}
- 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.
推薦閱讀
- Unity 2020 By Example
- Getting Started with React
- What's New in TensorFlow 2.0
- Android 9 Development Cookbook(Third Edition)
- 云原生Spring實戰
- TypeScript實戰指南
- Redis Essentials
- 小學生C++創意編程(視頻教學版)
- Mastering Gephi Network Visualization
- Python Machine Learning Cookbook
- C++服務器開發精髓
- HTML5+CSS3+jQuery Mobile+Bootstrap開發APP從入門到精通(視頻教學版)
- Python程序設計:基礎與實踐
- Android從入門到精通
- C語言從入門到精通(第5版)