項目中添加一個類文件,該文件中定義一個方法,輸出“學C#”,代碼如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace EX5_1{class Class{class Demo{public void OutMethod(){Console.WriteLine("學C#");Console.Read();}}}}在自動生成的Program.cs文件中調用上述生成類文件中封裝的方法,代碼如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace EX5_1{class Program{static void Main(string[] args){Demo d = new Demo();d.OutMethod();}}}運行后的錯誤列表提示:找不到類型或命名空間名稱“Demo”(是否缺少using指令或程序集引用?)第12行這照書搬下來的,高手賜教吧~~~~(>_<)~~~~
- 1 回答
- 0 關注
- 1000 瀏覽
添加回答
舉報
0/150
提交
取消