i am facing problem with the return type for this function and not really getting anywhere near solving can someone help me with this?
here goes the function,
public IQueryable<System.Collections.Generic.Dictionary<discussion_category, List<discussion_board>>> GetDiscussion_categoriesWithBoards()
{
return GetDiscussion_categories().Select(c =>
new
{
Category = c,
Boards = GetDiscussion_boardsByCategory(c.ID).ToList()
}).ToDictionary(i => i.Category, i => i.Boards.ToList());
}
this is the other function that works which is used in the above function that doen’t work,
public IQueryable<discussion_board> GetDiscussion_boardsByCategory(int CategoryID)
{
return this.ObjectContext.discussion_boards.Where(e => e.CategoryID == CategoryID);
}
public IQueryable<discussion_category> GetDiscussion_categories()
{
return this.ObjectContext.discussion_categories;
}
I need this to be the return type:
IQueryable<System.Collections.Generic.Dictionary<discussion_category, List<discussion_board>>>
thank you friends!
Since you’re calling ToDictionary(), your method returns a
Dictionary<>, not anIQueryable<>:If you absolutely want to return an
IQueryable<>you can write something like: