应用程序域的用法

--存储数据:
List<string> keyList = new List<string> { "a", "b", "c" };
foreach (string key in keyList)
{
    AppDomain.CurrentDomain.SetData(key, key + key);
}

--取数据
foreach (string key in keyList)
{
    object obj = AppDomain.CurrentDomain.GetData(key);
    Console.WriteLine(obj.ToString());
}

--若是想移除某一项,则是这样处理的
AppDomain.CurrentDomain.SetData(key, null);
设置为空之后,则会被回收

posted @ 2013-06-04 12:19  pnljs  阅读(144)  评论(0编辑  收藏  举报