I. arraylist stores two-dimensional arrays.
Why is arraylist used?
Arraylist is a dynamic array. It can declare and strengthen without knowing the length, and can be modified as needed.
State to increase the length, size, and delete any index content. These are not available in common arrays.
String [] get_num = new string [3]; // creates a cute array for your examples
Get_num [0] = "8, 5, 12, 12 ";
Get_num [1] = "82,52, 52,42 ";
Get_num [2] = "112,132 ";
Arraylist Al = new arraylist (); // declare and strengthen a silly arraylist
Arraylist Al = new arraylist (); // declare and strengthen a silly arraylist
For (INT I = 0; I <get_num.length; I ++)
{
String [] get_numarray = get_num [I]. Split (','); // cut the ordinary array according to ","
For (Int J = 0; j <get_numarray.length; j ++)
{
Al2.add (double) (double. parse (get_numarray [J]); // The default value of this example is the double class.
Type to add the second-dimensional content to Al 2.
}
Al. Add (double []) al2.toarray (typeof (double); // Add the content of the first dimension to Al
Al2.clear (); // clear the content to avoid the second-dimensional Accumulation
}
Double [] [] get_countnum = (double [] []) Al. toarray (typeof (double []); // OK! He's full, Al is transferred
Convert to a 2-dimensional array
Self-written
If (! Ispostback)
{
String [] A = Common. dealersrol (). Split (New char [] {','});
Arraylist Al = new arraylist ();
Arraylist Al = new arraylist ();
For (INT I = 0; I <A. length; I ++)
{
String [] B = A [I]. Split (New char [] {'| '});
For (Int J = 0; j <B. length; j ++)
{
Al2.add (string) B [J]);
}
Al. Add (string []) al2.toarray (typeof (string )));
Al2.clear ();
}
String [] [] C = (string [] []) Al. toarray (typeof (string []);
Dropdownlist1.datasource = C;
Dropdownlist1.databind ();
}