1

I am trying to do this on a method which is basically a mapper - maps old categories List to a new List. The OldCategory has fewer properties.

return categories = from c in oldCategories select new Category 
{  
   CategoryName = c.CategoryName, 
   Id = c.CategoryId, 
   Teams = CombineTeam(c.Team, coreTeam)
};

Why can't I use CombineTeam method in the expression? Help appreciated. Thanks

UPDATE: Not working because c.Team is IQueryable and CombineTeam methods takes a List

Can anyone help me convert IQueryable to List within the expression?

2
  • 2
    Here is the method CombineTeam defined? How about the variable coreTeam? Commented Dec 21, 2009 at 23:06
  • Is oldCategories an object already in memory, or is it a Linq-to-Sql/Entities expression? Commented Dec 21, 2009 at 23:12

1 Answer 1

2
return categories = from c in oldCategories select new Category 
{  
CategoryName = c.CategoryName, 
Id = c.CategoryId, 
Teams = CombineTeam(c.Team.ToList(), coreTeam)
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.