Converting ObsevableCollection foreach to lambda.

Posted by Jitendra Jadav on Stack Overflow See other posts from Stack Overflow or by Jitendra Jadav
Published on 2011-03-05T07:22:45Z Indexed on 2011/03/05 7:24 UTC
Read the original article Hit count: 244

Filed under:

Hello Guys, I am working some ObservableCollection converting to lembda it will give me error

this is my actual code .

        foreach (var item in Query)
        {
            userDetail.Add(new UserDatail(item.ID,item.Name, item.Address, item.City, item.Pin, item.Phone));
        }

and I am try to add as lembda

        Query.ToList().ForEach(x => userDetail.Add(x.ID,x.Name,x.Address,x.City,x.Pin,x.Phone));

This will give me error.

Thanks..

© Stack Overflow or respective owner

Related posts about lambda