谁能帮我解释一下下面语句的语法:
if(!HttpContext.Current.IsDebuggingEnabled &&
HttpContext.Current.Application["TreeConfig" + treeId] != null)
      //Application["TreeConfig" + treeId]是什么意思?
{
return (TreeConfigData)HttpContext.Current.Application["TreeConfig" + this.treeId];
}
treeId已经定义的变量
TreeConfigData是一个数据集

解决方案 »

  1.   

    完整代码是这个样子:
    private TreeConfigData LoadConfig()
    {
    if(!HttpContext.Current.IsDebuggingEnabled &&
    HttpContext.Current.Application["TreeConfig" + treeId] != null)
    {
    return (TreeConfigData)HttpContext.Current.Application["TreeConfig" + this.treeId];
    }
    else
    {
    TreeConfigData configData = new TreeConfigData();
    using(SqlConnection conn = new SqlConnection(this.ConnString))
    {
    SqlCommand cmd = new SqlCommand(@"select * from Sys_Tree where TreeId = @TreeId",conn);
    cmd.Parameters.Add("@TreeId",treeId);
    SqlDataAdapter sda = new SqlDataAdapter(cmd);
    sda.TableMappings.Add(new DataTableMapping("Table", "Sys_Tree"));
    sda.Fill(configData);
    }
    HttpContext.Current.Application["TreeConfig" + treeId] = configData;
    return configData;
    }
    }
      

  2.   

    Application对象的一个属性值拉,Application["属性名"]=XXX
    if(Application["属性名"]==XXX)
    {
    //code
    }
      

  3.   

    Application[]引用的是一个全局变量,在一些页面传值的情况下就可以用其来传值,关于页面传值还可以用Session,Cookie,,,,具体的LZ查一些资料就可以了呀...