I'm throwing this out there hoping there's a LINQ guru lurking among my readership somewhere.
I'm trying to add a Row Number Column to a LINQ query. In fact, this looks to be exactly what I want to do, however his example won't compile for me - "An expression tree may not contain an assignment operator".
I'm hoping there's something simple and obvious I've missed. My code looks something like:
int i = 1;
args.Result = from userimage in db.UserImages
where userimage.UserID == userGuid.Value
select new
{
userimage.ImageID,
Name = userimage.Image.ImageName,
rowId = i++
};
ImageID is a Guid in this case, otherwise I could probably make do with that.
Posted on Monday, June 9, 2008 11:25 PM |