- .NET Standard 2.0 Cookbook
- Fiqri Ismail
- 305字
- 2021-06-25 22:11:39
How to do it...
- Open Visual Studio 2017.
- Click File | New | Project and, in the New Project template dialog box, select Visual Studio Solutions under the Other Project Types node in the left-hand pane and then Blank Solution in the right-hand pane.
- In the Name: text box, type Chapter2.Reflections as the name of the solution. Select a preferred location under the Location: drop-down list or click Browse... button and select a location. Leave the defaults as they are:
- Click OK.
- Now, in the Solution Explorer (or press Ctrl + Alt + L), select Chapter2.Reflections. Right-click and select Add | New Project.
- In the Add New Project dialog box, expand the Visual C# node and select .NET Standard in the left-hand pane.
- In the right-hand pane, select Class Library (.NET Standard):

- Now, in the Name: text box, type Chapter2.Reflections.CalculatorLib and leave the Location: text box as it is:

- Click OK.
- Now, the Solution Explorer (press Ctrl + Alt + L to open) should look like this:

- Select Class1.cs in the project tree and press F2.
- Rename Class1.cs as Calculator.cs, also making sure that you have done the same to the class name itself:
using System;
namespace Chapter2.Reflections.CalculatorLib
{
public class Calculator
{
}
}
- Now, the Solution Explorer should look like this:

- In the code window, and in between the curly brackets of the Calculator class, write the following code:
public int Add(int number1, int number2)
{
return number1 + number2;
}
public int Subtract(int number1, int number2)
{
return number1 - number2;
}
- Let's do a quick build by pressing Ctrl + Shift + B.
推薦閱讀
- 深入核心的敏捷開發:ThoughtWorks五大關鍵實踐
- Visual Basic .NET程序設計(第3版)
- Mastering NetBeans
- Java多線程編程實戰指南:設計模式篇(第2版)
- 機器學習系統:設計和實現
- 程序員考試案例梳理、真題透解與強化訓練
- Essential Angular
- 精通Scrapy網絡爬蟲
- JavaScript動態網頁開發詳解
- Learning Salesforce Einstein
- 測試架構師修煉之道:從測試工程師到測試架構師
- Scratch從入門到精通
- Oracle Database XE 11gR2 Jump Start Guide
- Visual Basic程序設計基礎
- SQL Server 2014 Development Essentials