摘要: class myclass{}类属性 :public internal abstract sealed static unsafe partial类名: 类型参数 唯一基类 多个接口类体内:方法 属性 索引器 事件 字段 构造方法 运算符函数 嵌套类型 析构函数字段类中的变量 可以用到的修饰符有st... 阅读全文
posted @ 2015-06-11 14:52 hlhxd 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 命名空间 命名空间把相关类组织在一块,避免命名冲突,也更容易找到类。命名空间是独立于程序集的。namespace out.mid.inner{ class class1{} class class2{}}namespace out{ namespace mid{ namespace inner{ c... 阅读全文
posted @ 2015-06-11 10:32 hlhxd 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 变量 :局部变量 参数 字段 数组栈:保存局部变量 和参数的地方 ,函数调用创建栈空间 函数退出释放栈空间。堆:对象占有的那块内存。静态字段 常量 也在堆空间。但是一直程序结束时释放。decimal d = default(decimal);局部变量 没赋值前不能使用,而数组 字段 会用默认值填充。 阅读全文
posted @ 2015-06-11 07:31 hlhxd 阅读(120) 评论(0) 推荐(0) 编辑
摘要: char[] vowels = new char[5];char[] b = new char[5]{'a','e','i','o','u'};char[] b = 'a','e','i','o','u'};所有数组都继承自system.array ,提供了通用服务,二维数组int[,] m = n... 阅读全文
posted @ 2015-06-10 15:49 hlhxd 阅读(106) 评论(0) 推荐(0) 编辑
摘要: char 类型 表示一个unicode 字符 2个字节char a ='\u000A';char a='\ ??';转义字符字符串类型 string a = "heat";string 类型是引用类型 ,但是判断相等时看值 string a = "hello"; string b = "hello"... 阅读全文
posted @ 2015-06-10 15:27 hlhxd 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 布尔类型 bool 和 int不能相互转换bool 判断引用类型相等时判断的是引用地址 而不是值。 阅读全文
posted @ 2015-06-10 15:13 hlhxd 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 数值后缀 float f = 1.0f; double d = 1D; decimal d = 1.1m;数值类型转换 int x =1234; long y = x;short z = (short)x; int i=1; float f = i;int d = (int)f;整形运算溢出检查运算... 阅读全文
posted @ 2015-06-10 14:55 hlhxd 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 变量是存储位置的符号 ,它包含的值可以变化。常量的值则一直保持不变const int y = 365;预定义类型 预定义类型是编译器支持的类型 比如 int string bool.System 命名空间下 DateTime 不是内置类型。自定义类型 using System; public cla... 阅读全文
posted @ 2015-06-10 13:33 hlhxd 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 标示符 和 关键字关键字被编译器保留了,用户不能使用,以免冲突。字面值 分隔符 和运算符 字面值是静态嵌入程序中的原始数据片段。分隔符 ; {}注释 ///* */ 阅读全文
posted @ 2015-06-10 11:22 hlhxd 阅读(106) 评论(0) 推荐(0) 编辑
摘要: using System; //导入命名空间class Test{ // 申明类 static void Main() //方法声明 { int x = 12*30; // 语句 Console.WriteLine(x); // 语句 } //方法结束} //类结束语句以;结束 12*30 的值... 阅读全文
posted @ 2015-06-10 11:15 hlhxd 阅读(114) 评论(0) 推荐(0) 编辑