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

How to do it...

  1. Open Visual Studio 2017.
  2. 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.
  3. 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:


  1. Click OK
  2. Now, in the Solution Explorer (or press Ctrl + Alt + L), select Chapter2.Reflections. Right-click and select Add | New Project.
  3. In the Add New Project dialog box, expand the Visual C# node and select .NET Standard in the left-hand pane. 
  1. In the right-hand pane, select Class Library (.NET Standard):
  1. Now, in the Name: text box, type Chapter2.Reflections.CalculatorLib and leave the Location: text box as it is:
  1. Click OK.
  1. Now, the Solution Explorer (press Ctrl + Alt + L to open) should look like this: 
  1. Select Class1.cs in the project tree and press F2
  2. 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
{
}
}
  1. Now, the Solution Explorer should look like this: 
  1. 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;
}
  1. Let's do a quick build by pressing Ctrl + Shift + B
主站蜘蛛池模板: 和硕县| 特克斯县| 永仁县| 丰宁| 平阳县| 泽州县| 淮滨县| 长乐市| 扎兰屯市| 漠河县| 柳河县| 贡嘎县| 七台河市| 舞阳县| 永城市| 日照市| 莱西市| 平塘县| 武胜县| 阜阳市| 新平| 台南县| 蒙阴县| 清远市| 苗栗市| 泸西县| 墨竹工卡县| 峡江县| 綦江县| 姚安县| 栖霞市| 铜梁县| 卢氏县| 定安县| 孝昌县| 日土县| 淮南市| 上虞市| 和平县| 呼玛县| 新竹县|