得到List<HashTable>里面的list然后取list的某一项

//得到List<HashTable>里面的listUnFix然后取listUnFix判断tempfix里面得值

 

   List<Hashtable> list = new List<Hashtable>();

for (int i = 1; i <= 3; i++)
{

List<Hashtable> listUnFix = new List<Hashtable>();
foreach (var unq in unfixeditemlist)
{
if (unq.isfix)
{
continue;
}
Hashtable ht = new Hashtable();
ht.Add("id", unq.id);
ht.Add("tempfix", unq.tempfix ? "1" : "0");
ht.Add("unfixname", unq.name);
listUnFix.Add(ht);
}

Hashtable htSecurityLevel = new Hashtable();
htSecurityLevel.Add(string.Format("level{0}", i), listUnFix);
list.Add(htSecurityLevel);
}

for (int i = 0; i < list.Count; i++)
            {
                Hashtable ht = list[i];
                for (int j = 0; j < ht.Count; j++)
                {
                    List<Hashtable> list1 = ht[string.Format("level{0}", j.ToString())] as List<Hashtable>;
                    for (int k = 0; k < list1.Count; k++)
                    {
                        Hashtable ht1 = list1[k];
                        if (ht1["tempfix"].ToString() == "0")
                        {
//内容
                        }
                    }
                }

posted @ 2019-12-04 15:19  枫岫  阅读(783)  评论(0编辑  收藏  举报