.net - How to declare dynamic array in c# -
i working on silverligth5
(my previous experience c++)and have create dynamic array size decided dynamically.
until have static , it's this:
string[] position = new string[20]; //it must dynamic don't want fix 20 (int = 0; < pv.root.parameter.count; i++) { if (name == pv.root.parameter[i].name) { position[i] = name; } }
as can seen way have size 20
, want of same length pv.root.parameter.count
.
how achieve ?
edit/ problem when try achieve through list : have problem @ line :
if (pv.root.parameter[loopcount].name == position[loopcount]) { rowgrid.opacity=0.3; }
because surely not work position[loopcount]
because position list , cannot indexed this. how index ?
pass pv.root.parameter.count
instead of 20
array length.
string[] position = new string[pv.root.parameter.count];
or use list, if don't want fixed size.
Comments
Post a Comment