Sunday

linq select into class list

let's say we have following class:

public class GridCell {
public string page_name{get;set;}
public string link_code { get; set; }
public int page_state { get; set; }
public int landing_pages_id { get; set; }

}

and want to create list of these classes , to bind them to grid for example :
LandingPagesDataContext lpdc = new LandingPagesDataContext();
var query = from p in lpdc.landing_pages
select new { p.page_name, p.link_code, p.page_state, p.landing_pages_id };
bind(query.Select(p=>new GridCell{page_name = p.page_name, link_code = p.link_code, page_state = p.page_state, landing_pages_id = p.landing_pages_id }).ToList<GridCell>());

No comments:

here is powershell script on how to get list of files from changesets associated with one tfs task

$dllPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\...