日期:2014-05-17 浏览次数:21183 次
//以下代码是在主线程中
//TryAdd全部是添加成功的
ConcurrentDictionary<string, ConcurrentDictionary<ECommandPriority, ConcurrentDictionary<string, CommandFlag>>> dcCommandList;
//ECommandPriority是一个枚举。
this.dcCommandList = new ConcurrentDictionary<string, ConcurrentDictionary<ECommandPriority, ConcurrentDictionary<string, CommandFlag>>>();
if (this.dcCommandList.TryAdd(terminalPhone, new ConcurrentDictionary<ECommandPriority, ConcurrentDictionary<string, CommandFlag>>()))
{
if (!this.dcCommandList[terminalPhone].TryAdd(ECommandPriority.Highest, new ConcurrentDictionary<string, CommandFlag>()))
{
}
if (!this.dcCommandList[terminalPhone].TryAdd(ECommandPriority.Normal, new ConcurrentDictionary<string, CommandFlag>()))
{
}
if (!this.dcCommandList[terminalPhone].TryAdd(ECommandPriority.Lowest, new ConcurrentDictionary<string, CommandFlag>()))
{
}
}
else
{
}