I have written
List<int> Uids = new List<int>();
Uids = (from returnResultSet in ds.ToList()
from portfolioReturn in returnResultSet.Portfolios
from baseRecord in portfolioReturn.ChildData
select new int
{
id = baseRecord.Id
}).ToList<int>();
Getting error: ‘int’ does not contain a definition for ‘id’
what is the problem that i created?
Thanks
Try this:
Since you want to get a list of integers you can simply project the
Idproperty from your query and then use theToListextension method to buffer them into aList<T>. As a side note, are you certain that aList<T>is the right type to use here? You are forgoing the benefit of deferred execution and will not be able to stream these ids if you buffer them into aList<T>.