3 回答

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超13個(gè)贊
C#動態(tài)創(chuàng)建數(shù)組不同于VB,C#動態(tài)創(chuàng)建數(shù)組通過一個(gè)實(shí)例介紹了C#動態(tài)創(chuàng)建數(shù)組的具體實(shí)現(xiàn)。
C#動態(tài)創(chuàng)建數(shù)組實(shí)例:
1 2 3 4 5 6 7 8 9 10 11 12 13 | ArrayList al = new ArrayList(); al.Add("song"); al.Add("yun"); String[] arr2; arr2 = (String[])(al.ToArray(typeof(String))); System.Diagnostics.Debug.Print("Arr2[0]=" + arr2[0]); //type of int ArrayList al2 = new ArrayList(); al2.Add(23); al2.Add(4); int[] arr3; arr3 = (int[])(al2.ToArray(typeof(int))); System.Diagnostics.Debug.Print("Arr3[0]=" + arr3[0]); |

TA貢獻(xiàn)1898條經(jīng)驗(yàn) 獲得超8個(gè)贊
C#動態(tài)創(chuàng)建數(shù)組不同于VB,C#動態(tài)創(chuàng)建數(shù)組通過一個(gè)實(shí)例介紹了C#動態(tài)創(chuàng)建數(shù)組的具體實(shí)現(xiàn)。
C#動態(tài)創(chuàng)建數(shù)組實(shí)例:
ArrayList al = new ArrayList(); al.Add("song"); al.Add("yun"); String[] arr2; arr2 = (String[])(al.ToArray(typeof(String))); System.Diagnostics.Debug.Print("Arr2[0]=" + arr2[0]); //type of int ArrayList al2 = new ArrayList(); al2.Add(23); al2.Add(4); int[] arr3; arr3 = (int[])(al2.ToArray(typeof(int))); System.Diagnostics.Debug.Print("Arr3[0]=" + arr3[0]);
- 3 回答
- 0 關(guān)注
- 1391 瀏覽
添加回答
舉報(bào)