我在课堂上有以下访问器Glass:
public bool isGlassEnabled{
get {
if (System.Environment.OSVersion.Version.Major >= 6) {
DwmIsCompositionEnabled( ref en );
if (en > 0) {
return true;
} else { return false; }
} else { return false; }
}
}
(我不确定代码是否有效,但这不是我感兴趣的)
现在我们位于MainClass. 有没有可能isGlassEnabled像这样访问:
bool myBool = **without new** Glass.isGlassEnabled;