积极答复者
请问 在重写控件 是 前面声明的这些变量 是什么意思啊 谢谢

问题
-
private static MenuTimer menuTimer = new MenuTimer();
private static readonly int PropShortcutKeys = PropertyStore.CreateKey();
private static readonly int PropCheckState = PropertyStore.CreateKey();
private static readonly int PropMdiForm = PropertyStore.CreateKey();
private static readonly object EventCheckedChanged = new object();
private static readonly object EventCheckStateChanged = new object();
答案
-
估计这些变量是要被多个控件实体共享的。
其中:
static:表示静态,这样无论创造多少个实体都共享同一个变量。
readonly:只读,表示该变量只能在构造函数中被初始化,其余地方均不能赋值。
具体的意思需要按照上下文决定(整个代码)。
- 已建议为答案 Mike FengModerator 2012年5月31日 4:57
- 已标记为答案 Mike FengModerator 2012年6月6日 12:14
全部回复
-
估计这些变量是要被多个控件实体共享的。
其中:
static:表示静态,这样无论创造多少个实体都共享同一个变量。
readonly:只读,表示该变量只能在构造函数中被初始化,其余地方均不能赋值。
具体的意思需要按照上下文决定(整个代码)。
- 已建议为答案 Mike FengModerator 2012年5月31日 4:57
- 已标记为答案 Mike FengModerator 2012年6月6日 12:14