字典int,myclass

时间:2015-06-14 10:12:11

标签: list c#-4.0 dictionary

That's my class

public class PersonelAtama
{
   public int PersonelID { get; set; }
   public int YonetimTalepID { get; set; }
   public bool durum { get; set; }
}

我想Dictionary<int,list<myclass>>

 Dictionary<int, List<PersonelAtama>> 
 PersonelAtamaListesi = new Dictionary<int, List<PersonelAtama>>();

如何插入列表

PersonelAtamaListesi.Add 

如何进行作业

PersonelAtamaListesi[0][1]  


PersonelAtamaListesi.Add(0,new PersonelAtama()
    {
        PersonelID = personelID,
        YonetimTalepID = yonetimTalepID,
        durum = false
    });

分配到列表中以及如何再次使用

我想添加到列表和组件值来实现。我想抽样代码。

1 个答案:

答案 0 :(得分:0)

ListTValue所以:

PersonelAtamaListesi.Add(0, new List<PersonelAtama>()
                            {
                                new PersonelAtama()
                                {
                                    PersonelID = 1,
                                    YonetimTalepID = 2,
                                    durum = false
                                },
                                new PersonelAtama()
                                {
                                    PersonelID = 11,
                                    YonetimTalepID = 222,
                                    durum = true
                                }
                            });