I have data like:
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("1", "ABC1");
dic.Add("2", "ABC2");
dic.Add("3", "ABC3");
dic.Add("4", "ABC4");
dic.Add("5", "ABC5");
dic.Add("6", "ABC6");
string[] col = new string[] { "1", "4", "5" };
needed a result string array in the same order as col array like:
string[] res = new string[] { "ABC1", "ABC4", "ABC5" };
tried with for loop but needed in linq
string[] res = new string[col.Length]; // { "ABC1", "ABC4", "ABC5" };
for(int i=0;i<col.Length;i++)
{
res[i] = dic[col[i]];
}