How to store SortedList in Session or Cache.

Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 1082
Import System.Collections namespace at the top of .cs or .vb page as

Imports System.Collections

Dim lst As New SortedList()
Session("SortedList") = lst

'To convert Session again into SortedList,we will write below code:-
Dim sort_lst_obj As SortedList = CType(Session("SortedList"),SortedList)

'To access value from SortedList
Dim str_value1 As String = sort_lst_obj("Key1")
Dim str_value2 As String = sort_lst_obj("Key2")

Comments or Responses

Login to post response