VS2015的C#环境好搭建&hello word&命名空间的定义&类的定义

环境搭建

1.创建C#的信息.

1.创建C#的信息.

2.编写c#的hello Word

C#编写hello Word

c#编写hello word

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类
{

}
}

类-一种数据结构,存储数据成员,方法成员.其他等内容.方便调用;类名称不能重复

类-使用方法

class 类名
{
//类中的代码
}
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

初上花样年华

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值