LINQ Join for Orderby only

Posted by RandomBen on Stack Overflow See other posts from Stack Overflow or by RandomBen
Published on 2010-04-07T20:08:46Z Indexed on 2010/04/07 20:13 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

I am trying to run this code:

ItemTaxonomy iTaxonomy = from itemTaxonomy in connection.ItemTaxonomy
                         where itemTaxonomy.Item.ID == itemView.ID
                         orderby itemTaxonomy.Taxonomy.Name
                         select itemTaxonomy;

When I compiled it I get the error:

Cannot implicitly convert type 'System.Linq.IOrderedQueryable<Website.Models.ItemTaxonomy>' to 'Website.Models.ItemTaxonomy'. An explicit conversion exists (are you missing a cast?)

I believe the issue is with orderby itemTaxonomy.Taxonomy.Name but I am just trying to order by the name of Taxonomy items instead of their IDs. Is there a way to do that?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET