namespace 索引
{
class Program
{
static void Main(string[] args)
{
Session se = new Session();
se["username"] = "zhangsan";
Console.Write(se["username"]);
Console.ReadKey();
}
}
public class Session
{
Dictionary<string, object> dic = new Dictionary<string, object>();
public void Add(string name, object value)
{
dic.Add(name, value);
}
public object this[string name]
{
get{return dic[name];}
set { dic.Add(name, value); }
}
}
}