Change the for loop with lambda(C#3.0)
- by Newbie
Is it possible to do the same using Lambda
for (int i = 0; i < objEntityCode.Count; i++)
{
options.Attributes[i] = new EntityCodeKey();
options.Attributes[i].EntityCode = objEntityCode[i].EntityCodes;
options.Attributes[i].OrganizationCode = Constants.ORGANIZATION_CODE;
}
I mean to say to rewrite the statement using lambda. I tried with
Enumerable.Range(0,objEntityCode.Count-1).Foreach(i=> { options.Attributes[i] = new EntityCodeKey(); options.Attributes[i].EntityCode = objEntityCode[i].EntityCodes; options.Attributes[i].OrganizationCode = Constants.ORGANIZATION_CODE; });
but not working
I am using C#3.0