LINQ in Action roller

"Manually" add an element to a IQueryable

Hi there I'm using the following method to retrieve a collection of departments. I wanted to add an extra department (called "All") since it doesn't exist in the database. It works, but I'm sure there's a better way to do this in LINQ : Code Snippet public object SelectDepartments ( ) { var departments = from depts in tables. Department orderby depts. lblDepartment select new { depts. idDepartment , depts. lblDepartment } ; var allDepartments = new { idDepartment = 0 , lblDepartment = "All" } ; var Read More...
Published Sunday, July 06, 2008 6:12 PM by MSDN Forums: LINQ Project General
Anonymous comments are disabled

Featured Item

This Blog

Sponsoring

Syndication