Scott:
You can access ArrayLists with an index as if they were a normal array, this
is what differentiates it from a normal list. Check this example:
using System;
using System.Collections;
class myApp
{
static void Main()
{
ArrayList al = new ArrayList();
al.Add(10);
al.Add(20);
al.Add(30);
al.Add(40);
al.Add(50);
al.Add(60);
Console.WriteLine(al[0]);
Console.WriteLine(al[4]);
}
}
-----Mensaje original-----
De: Scott Weston [mailto:[EMAIL PROTECTED]]
Enviado el: Mar 21/05/2002 02:17 p.m.
Para: [EMAIL PROTECTED]
CC:
Asunto: [DOTNET] C# arraylists
Is there a way to get a value out of an arraylist like in an indexed array w/o
enumerating?
Basically I want to choose a random value out of the list.
So what is the best method for doing this rather than
loop until i = random_number - 1
enumerate
end loop
get next value
- Scott Weston -
IT Coordinator / Software Engineer
DISTek Integration, Inc.
[EMAIL PROTECTED]
319.266.7333x100
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
b‹œjzÞiÙž²Æ zÇë¢kax3“4DÚÈb½ë§²æìr¸›yúè˜3“4Dè®Ë›±Êâmëh¢Ø^¬7¯zZ)1éí¢¹b²Û¶m§ÿÝŠÇ.²Ç^½éh¥Ê&