C# Dynamic array -
i want array contain strings, floats , ints can accessed via index key.
i have example in lua how don't know how in c#
bookarray = []; bookarray[1] = { name = "book 1"; price = 50; wpp = 374; pages = 42; }
you may create class , use list<myclass>
class myclass { public string name {get;set;} public double price {get;set;} public int pages {get;set;} } here list:
list<myclass> values = new list<myclass>(); adding item
values.add(new myclass(){name = "book 1", pages = 42, price=50.0}); insert @ specific index:
values.insert(0,new myclass(){name = "book 2", pages = 432, price=10.0}); retrieve @ specific index:
myclass theclass = values[1];
Comments
Post a Comment