I was wondering if there is a better way to rewrite the codes as follows,
List<string[]> AgentList = fmCompany.getAllTransferredAgent();//2 elements, ecPortID and CS_Officer
string officer = "";
if (AgentList.Any(s => s.Contains(itemObj.EcportID, StringComparer.CurrentCultureIgnoreCase)))
{
foreach (string[] item in AgentList)
{
if (item[0].ToLower() == itemObj.EcportID.ToLower())
{
officer = item[1];
break;
}
}
}
else
{
officer = itemObj.EcportID;
}
I know dictionary will be able to help to solve this question,
but i would love to know is there any other way by using linq?
Go to the complete details ...