using System;
using System.Collections;
public class SamplesArrayList
{
public static void Main()
{
ArrayList myAL = new ArrayList();
myAL.Add( "the" );
myAL.Add( "quick" );
myAL.Add( "brown" );
myAL.Add( "fox" );
myAL.Add( "the" );
String myString = "the";
int myIndex = -1;
myIndex = myAL.IndexOf( myString, 4 );
Console.WriteLine(myIndex );
}
public static void PrintIndexAndValues(IEnumerable myList)
{
int i = 0;
foreach (Object obj in myList)
Console.WriteLine(" [{0}]: {1}", i++, obj);
}
}
|