摘要: 1: using system; 2: namespace hello 3: { 4: public class name 5: { 6: static void Main() 7: { 8: Console.WriteLine("Hello world!"); 9: } 10: } 11: 12: } 阅读全文
posted @ 2010-04-22 15:17 知识碎片 阅读(105) 评论(0) 推荐(0) 编辑
摘要: const和readonly这对“顽固”的兄弟着实会让我这样的菜鸟迷惑。 研究了一番算是有所感悟了。 const常量在编译时就会确定值,编译器直接进行值replace,就像是C语言里的#define。它本身就是static类型的,所以它不能与static共用。有位expert认为它可以作为一个static的子集来理解,我觉得这是可取的。另外它必须在声明时进行初始化。 readonly则是在运行... 阅读全文
posted @ 2010-04-22 11:19 知识碎片 阅读(156) 评论(0) 推荐(0) 编辑