请高人帮我解释一下下面语句的语法:
if(!HttpContext.Current.IsDebuggingEnabled &&
HttpContext.Current.Application["TreeConfig" + treeId] != null)
//Application["TreeConfig" + treeId]是什么意思? {
return (TreeConfigData)HttpContext.Current.Application["TreeConfig" + this.treeId];
}
treeId已经定义的变量
TreeConfigData是一个数据集
if(!HttpContext.Current.IsDebuggingEnabled &&
HttpContext.Current.Application["TreeConfig" + treeId] != null)
//Application["TreeConfig" + treeId]是什么意思? {
return (TreeConfigData)HttpContext.Current.Application["TreeConfig" + this.treeId];
}
treeId已经定义的变量
TreeConfigData是一个数据集
解决方案 »
- C# 如何遍历VS中的语言版本存放在combox控件中(100分相求)
- listview 的列宽如何固定?
- asp.net保存文件对话框
- 那位可以举个简单的例子说明,基于事件的异步模式..
- 用Process打开cmd.exe,对有的命令,比如需要要确定的,怎么把确定需要的Y,或着N,都写进命令里呢?
- windows应用程序中,如何treeView的外边框随树节点的增加或展开而自动变长变宽?
- ip判断的问题!!!
- 两个窗体之间变量调用问题
- IIS最难解决的问题!
- 如果转换ARGB 到RGB
- 请教:XML读写问题?(新手上路,请多多指教)
- NickLee.Framework.2.0.0.3.Pro
那HttpContext.Current.Application["TreeConfig" + treeId] != null判断是否为空干什么啊?
有什么用?
有什么用?
---------------
如果不判断
return (TreeConfigData)HttpContext.Current.Application["TreeConfig" + this.treeId];这句话会爆掉的
(TreeConfigData)HttpContext.Current.Application["TreeConfig" + this.treeId]将对HttpContext.Current.Application["TreeConfig" + treeId] 执行强制转换,如果HttpContext.Current.Application["TreeConfig" + treeId] 值为null,转换会出异常。建议楼主看看.net语法方面的书。