using System;
class MainClass
{
public static void Main()
{
string[] myStrings = {"To", "be", "or", "not", "to", "be"};
string myString = String.Join(".", myStrings);
char[] myChars = {'b', 'e'};
int index = myString.IndexOfAny(myChars);
Console.WriteLine("'b' and 'e' occur at index " + index + " of myString");
index = myString.LastIndexOfAny(myChars);
Console.WriteLine("'b' and 'e' last occur at index " + index + " of myString");
}
}
|