Currently my code is like that
public class ExampleClass
{
private static string[] words = new string[] { "Word1","Word2","Word3","Word4","Word5" };
public static bool IsExist(string Word)
{
return words.Any(w => w == Word);
}
}
And am calling that as
ExampleClass.IsExist("Word1"); //Returns true
ExampleClass.IsExist("WordNotExist"); //Returns false
But i want to call like this
ExampleClass.IsExist["Word1"]; //Returns true
ExampleClass.IsExist["WordNotExist"]; //Returns false
How should i modify my class to do so please help me out