How to store SortedList in Session or Cache

Platform: ASP.NET|Category: Session

VB.NET

Dim x As New SortedList()
x.Add('Key1', 'ValueA')
x.Add('Key2', 'ValueB')

To store in Session:

Session('SortedList1') = x

and to retrieve

Dim y As SortedList = CType(Session('SortedList1'), SortedList)

C#

SortedList x = new SortedList();
x.Add('Key1', 'ValueA');
x.Add('Key2', 'ValueB');

To store in Session:

Session['SortedList1'] = x;

and to retrieve

SortedList y = (SortedList) Session['SortedList1'];