第一天

 
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 //上面的代码是 引用命名空间
 7 namespace _01.first_day     //项目命名
 8 {
 9     class Program           //类命名 program
10     {
11         //下面代码  Main方法或者函数, Main函数是程序的主入口
12         static void Main(string[] args)
13         {
14             Console.WriteLine("Hello World"); //“要打印的类容”
15             Console.ReadKey();  //暂停当前程序,等待用户按下任意键继续,按下的键显示在控制台当中
16         }//结束
17     }
18 }
19 //.cs结尾的是类文件
20 
21 //1)解决方案,项目及类之间的关系
22 //解决方案:公司
23 //项目:部门
24 //类:员工
25 
26 //生成解决方案快捷键Ctrl+shift+b  帮助查找语法错误

 

 1            ////变量类型  变量名
 2             ////变量名=值
 3             ////100
 4 
 5             //int number;//表示在内存中开辟了一块存储整数的空间,空间名为number
 6             //number = 100;//表示把100存储到了这块空间,“=”号在这并不表示等于的意思,表示附值
 7 
 8 
 9             //int n = 100;//简写形式
10 
11             int n = 3;//int整数类型,只能存储整数
12 
13             double d = 3.14;//double小数类型 存储整数及小数,精度15-16位
14 
15             string name = "张三";//string字符串类型,可以存储为空
16 
17             char gender = '';//char字符类型,最多最少只能有一个字符
18 
19             decimal m = 50000m;//decimal金钱类型,值后面加m,精度28-29位
20         }

 

 1       static void Main(string[] args)
 2         {
 3             //小练习
 4             string name = "卡卡西";
 5             int age = 30;
 6             string address = "火影村";
 7             string email = "kakaxi@qq.com";
 8             decimal money = 2000m;
 9             Console.WriteLine("我的名字叫" + name + ",我住在" + address + ",我年龄是" + age + ",我的邮箱是" + email+",我的工资是"+money);
10        
11             Console.ReadKey();
12         }
13     }
14 }

 

 1        static void Main(string[] args)
 2         {
 3             //占位符,挖几个坑,填几个坑,多填没效果,占位符按照挖坑的顺序输出
 4             int n1 = 1;
 5             int n2 = 2;
 6             int n3 = 3;
 7             Console.WriteLine("第一个数字是{0},第二个数字是{1},第三个数字是{2}",n1,n2,n3);
 8             Console.ReadKey();
 9         }
10     }
11 }

 

Ctrl+K+D:快速对其代码
Ctrl+J:快速弹出只能提示
Ctrl+K+C:注释所选代码
Ctrl+K+U:取消所选代码的注释
折叠沉余代码:#region  #EndRegion

 

1  变量的命名规范:
2         1.Camel 骆驼命名规范。要求变量名首单词字母要小写,其余每个单词的首字母要大写,多用于给变量命名
3                 highSchoolStudent
4         2.Pascal 命名规范。要求每个单词的首字母都要大写,其余字母小写,多用于给类或者方法命名
5                 HighSchoolStudent

 

posted @ 2017-08-01 09:52  守夜人灬  阅读(188)  评论(0编辑  收藏  举报