I did console application that must iterate over two dimensional array of strings and select values that contains in user input and show these values in set by "row". Unfortunately I got error System.Collections.Generic.List '1[System.String] Here is the code of application:
static void Main(string[] args)
{
string[,] words = new string[,]
{
{ "5", "" },
{ "10", "kare" },
{ "20", "kanojo" },
{ "1", "karetachi" },
{ "7", "korosu" },
{ "3", "sakura" },
{ "3", "" }
};
try
{
var pre = Console.ReadLine();
var r = Enumerable
.Range(0, words.GetLength(0))
.Where(i => words[i, 1] == pre)
.Select(i => words[i, 1])
.OrderBy(i => words[Int32.Parse(i), 0])
.ToList();
Console.Write(r);
}
catch (Exception ex)
{
TextWriter errorWriter = Console.Error;
errorWriter.WriteLine(ex.Message);
}
Console.ReadLine();
}