2011-05-23 67 views
0

我有一個名爲str的數組列表,我想查看該數組列表中有多少元素,我應該如何使用消息框來顯示它?使用消息框顯示數組列表中的元素數

+0

請添加代碼的一些細節和背景。什麼是「數組列表」?爲什麼它被稱爲'str'? – 2011-05-23 10:10:52

+0

希望你在尋找'數量'或'長度'或其他 – V4Vendetta 2011-05-23 10:10:54

回答

4

你可以做得到的長度和顯示它。

MessageBox.Show(str.Count.ToString()); 
3

ArrayList.Count

MessageBox.Show(string.Format("str: {0} element(s)", str.Count)); 
+0

謝謝這個作品 – GJJ 2011-05-23 11:03:17

0

嘗試

ArrayList arr = new ArrayList(); 
...... 
MessageBox.Show(arr.Count.ToString()); 
0
MessageBox.Show(str.Count.ToString());