摘要: 在继承类中用new关键字声明与基类同名的方法可以隐藏父类的方法base调用基类,相当于Java里的superthis调用当前对象,相当于Java里的this 阅读全文
posted @ 2011-07-15 17:23 绯色卡卡 阅读(266) 评论(0) 推荐(0)
摘要: 定义字段readonly 字段只能在执行构造函数的过程中赋值,或者由初始化赋值语句赋值定义方法virtual 方法可以重写abstract 方法必须在非抽象的派生类中重写(只用于抽象类中)override 方法重写了一个基类方法(如果方法被重写,就必须使用该关键字)extern 方法定义放在其他地方定义属性private int myInt;Public int MyIntProp{ get { return myInt; } set { myInt = value; }} 阅读全文
posted @ 2011-07-15 16:47 绯色卡卡 阅读(222) 评论(0) 推荐(0)
摘要: public MyClass():base(5){}public MyClass:this(5,6){} 阅读全文
posted @ 2011-07-15 14:19 绯色卡卡 阅读(104) 评论(0) 推荐(0)
摘要: ClassName myClass = new ClassName();using(myClass){}变量myClass可以在using代码块内使用,并在代码块的末尾自动删除。 阅读全文
posted @ 2011-07-15 11:08 绯色卡卡 阅读(205) 评论(0) 推荐(0)
摘要: delegate double ProcessDelegate(double param1,double param2);ProcessDelegate process;process = new ProcessDelegate(divide);process(param1,param2);委托可以作为参数传递给函数 阅读全文
posted @ 2011-07-15 09:46 绯色卡卡 阅读(113) 评论(0) 推荐(0)
摘要: static void showDouble(ref int val){ val *= 2; Console.WriteLine("val double = {0}",val);}调用时变量名前也要加上 refref参数限制1.不可以为const2.必须初始化若未赋值,使用out参数 阅读全文
posted @ 2011-07-14 11:49 绯色卡卡 阅读(142) 评论(0) 推荐(0)
摘要: 矩形数组int array[,] = new int[3,4];int array[,] = {{1,2,3,4},{2,3,4,5},{3,4,5,6}};变长数组int[][] array = new int[2][];array[0] = new int[3];array[1] = new int[4];int[][] array = {new int[]{1,2,3},new int[] {1},new int[]{1,2}}; 阅读全文
posted @ 2011-07-13 17:28 绯色卡卡 阅读(105) 评论(0) 推荐(0)
摘要: foreach(string friendName in friendNames){ Console.WriteLine(friendName);}只读访问 阅读全文
posted @ 2011-07-13 17:12 绯色卡卡 阅读(164) 评论(0) 推荐(0)
摘要: checked(); 检查溢出unchecked(); 不检查溢出 阅读全文
posted @ 2011-07-13 16:19 绯色卡卡 阅读(108) 评论(0) 推荐(0)
摘要: #region Your Block Namecode...code...code...#endregion 阅读全文
posted @ 2011-07-13 11:16 绯色卡卡 阅读(1030) 评论(0) 推荐(1)