Hi guys,
The codes below are working but I don't it's the best efficient code as they are some repetitive code and I haven't figured out what the best the way to simplify it.
Appreciate your help on this codes below:
The codes below are working but I don't it's the best efficient code as they are some repetitive code and I haven't figured out what the best the way to simplify it.
Appreciate your help on this codes below:
Code:
for (int i = 0; i < CodeList.Count; i++)
{
if (!IsUpdateMode)
{
if (CodeList[i].CODE_ACTV_F.IsEqual("Y"))
{
KeyValuePairList.Add(new KeyValuePair<string, string>(CodeList[i].BRANCH_CODE, CodeList[i].BRANCH_CODE + " - " + CodeList[i].BRANCH_DESC + ")"));
}
}
else
{
if (CodeList[i].CODE_ACTV_F.IsEqual("Y") || CodeList[i].BRANCH_CODE.Trim() == sitecode.Trim())
{
KeyValuePairList.Add(new KeyValuePair<string, string>(CodeList[i].BRANCH_CODE, CodeList[i].BRANCH_CODE + " - " + CodeList[i].BRANCH_DESC + ")"));
}
}
}