using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _20200909tes1
{
class Program
{
static void Main(string[] args) //玫方法
{
Console.WriteLine("hello word");//打印hello word
Console.ReadLine();//固定框体
}
}
}
命名空间
命名空间-标设类的可见访问
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//通过1-5行执行第7行的命名空间
using Demo;//第8行 使能执行Demo空间
namespace Hello_word
//第1-5为命名空间 目的类的可见范围
//定义命名空间(hello word) 须使用namespace关键字
//格式:namespace 被定义的命名空间名称
{
class Program
//类:program
{
Test test = new Test();
/*hello word命名空间中使用Test??-1.先写关于Demo的命名空间
2.在Demo空间中写关于Test的类
3.开启第8行,使Demo的命名空间有效
4.通过Test方法,Demo空间能够在Hello word命名中执行成功*/
static void Main(string[] args)
//main方法
//hello word命名空间中使用main
{
//打印数据
Console.WriteLine("Hello word");
Console.ReadLine();
//标识符(Console)
}
}
}
namespace Demo
{
class Test
//创建Test类
{
}
}