当保存在Session中的对象,取出后,在外部发生改变时会怎样

            return_reason_model model = new return_reason_model();
            model.F_RetunrnReason = "1";
            HttpContext.Session["Return"] = model;
            model.F_RetunrnReason = "2";
            return_reason_model model2 = HttpContext.Session["Return"] as return_reason_model;

在上述代码中,model2.F_RetunrnReason=?? 答案是“2”

 

           int a = 1;
            HttpContext.Session["Return"] = a;
            a = 2;
            int b = (int)HttpContext.Session["Return"];

在上面代码中,b=?? 答案是1

posted @ 2018-07-20 16:10  牛小花  阅读(564)  评论(0编辑  收藏  举报