當保存在Session中的對象,取出後,在外部發生改變時會怎樣
阿新 • • 發佈:2018-07-20
tun nbsp clas tex mod 在外 代碼 tpc spa
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
當保存在Session中的對象,取出後,在外部發生改變時會怎樣