C# objects in arrayLists

后端 未结 4 785
北海茫月
北海茫月 2020-12-29 16:02

I\'m working with ArrayList in C# and I am wondering how I can add objects to an ArrayList and then retrieve the values from it?

In short,

4条回答
  •  我在风中等你
    2020-12-29 16:15

    im using similar method but im not able to use it..giving some error like object is field cannot use as type..:/ im wondering I was able to use it in java even with a ArrayList object..im understating it bcz mine object is field but why I cannot use it:(

    List lists = new List();

    person p2 = new person("Hammad", "Lahore", 1, 123);
    person p3 = new person("adnan", "Lahore", 1, 123);
    person p4 = new person("qamar", "Lahore", 1, 123);
    lists.Add(p2);
    

提交回复
热议问题