Please tell me what is the difference between indexOf and
indexOfAny in c sharp.
Other have already mentioned that it is pretty well documented.
But for illustration see the code below.
Arne
=============================
using System;
namespace E
{
public class Program
{
public static void Test(string s)
{
Console.WriteLine(s);
Console.WriteLine("IndexOf A = " + s.IndexOf('A'));
Console.WriteLine("IndexOf B = " + s.IndexOf('B'));
Console.WriteLine("IndexOf C = " + s.IndexOf('C'));
Console.WriteLine("IndexOfAny ABC = " + s.IndexOfAny(new
char[] { 'A', 'B', 'C' }));
}
public static void Main(string[] args)
{
Test("ABC");
Test("AX");
Test("XB");
Test("X");
Test("BA");
Console.ReadKey();
}
}
}