fasil Posted March 27, 2005 Posted March 27, 2005 I am trying loo through a ArrayList, but how do I get the length of the ArrayList, u know what in vbscript is Ubound(array). CartContent a = new CartContent(); ArrayList cardArray = a.GetCart(); foreach (?????){ PageMsg.Text += "Count this sentence to see how many elements"; } Quote
Administrators PlausiblyDamp Posted March 27, 2005 Administrators Posted March 27, 2005 You could always get the number of elements by using the Count property cardArray.Count; however the whole point of the foreach statement is that you do not need to know the number of elements. CartContent a = new CartContent(); ArrayList cardArray = a.GetCart(); //replace object with whatever class cardArray contains foreach(object o in cardArray) { //use o here } Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.