-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSessionStorage.cs
More file actions
39 lines (34 loc) · 916 Bytes
/
SessionStorage.cs
File metadata and controls
39 lines (34 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TestConsole
{
//SessionaStorage in memory, Dictionary implementation.
class SessionStorage
{
//public static List<string> list = new List<string>();
public static Dictionary<string, string> dict = new Dictionary<string, string>();
//https://developer.mozilla.org/es/docs/Web/API/Storage/setItem
public void setItem(string key, string data)
{
dict.Add(key, data);
}
public string getItem(string key)
{
return dict[key];
}
public void removeItem(string key)
{
dict.Remove(key);
}
public void clear(object p)
{
dict.Clear();
}
public object key(int n)
{
return dict[dict.Keys.ToList()[n]];
}
}
}