How to retrieve a generic list from session?

前端 未结 5 2157
[愿得一人]
[愿得一人] 2021-02-09 19:12

I have a list that I put in session:

Session.Add(\"SessionList\", mylist);

How to retrieve it back from the session?

5条回答
  •  既然无缘
    2021-02-09 19:35

    liek this...

     var list = Session["SessionList"] as List;
    

    or you can cast like this

     var List1 = (List)Session["SessionList"];  
    

提交回复
热议问题