2014年2月18日
摘要: 在开发过程中,经常用到Const和static readonly,这两个用法很像,一直以来没有彻底的去了解这两个,今天来做个总结本质区别: Const是在编译期间确定的,只能在申明时,通过常量赋值。 static readonly是在运行时确定的,可以通过构造函数来赋值。1 public class MyClass2 {3 public static readonly string Name = "Maple";4 public const string Address = "HuBeiWuHan";5 6 public st... 阅读全文
posted @ 2014-02-18 14:03 每次取名字都好难 阅读(489) 评论(0) 推荐(0) 编辑