Change the for loop with lambda(C#3.0)
Posted
by Newbie
on Stack Overflow
See other posts from Stack Overflow
or by Newbie
Published on 2010-05-12T03:06:30Z
Indexed on
2010/05/12
3:14 UTC
Read the original article
Hit count: 160
c#3.0
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
© Stack Overflow or respective owner