using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using N1;

namespace Test02
{
class Program
{
static void Main(string[] args)
{
A oa = new A();
oa.Myls();
}
}
}
namespace N1
{
class A
{
public void Myls()
{
Console.WriteLine(“用一生下载你”);
Console.ReadLine();
}
}
}
创建控制台应用程序,新建命名空间N1,在该空间有一类A,在项目中使用using指令引入命名空间N1.
然后在命名空间Test02中即可实现实例化命名空间N1中的类,最后调用该类中的Mysl方法(注意为public,否则显示方法不可访问,受保护级限制)

C#从入门到精通____2.2.2命名空间

相关文章:

  • 2021-11-21
  • 2021-11-27
  • 2021-12-16
  • 2021-04-24
  • 2021-12-19
  • 2021-07-27
  • 2022-01-03
  • 2021-10-09
猜你喜欢
  • 2021-09-15
  • 2022-12-23
  • 2021-09-27
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
相关资源
相似解决方案