static void Test() { string[,] arr = { { "aakif", "25" }, { "ali", "31" }, { "ben", "35" }, { "hassnain", "45" } }; string search = "ali"; string age = arr.GetAge(search); if ( age != null ) Console.WriteLine($"{search} age = {age}"); else Console.WriteLine($"{search} not found"); }