Linq select many from list and keep id

This example applies to if you want to select the id from class A and all flatten list elements from “ListB”:

public class A
{
int Id {get; set;}
List ListB {get; set;}
}

var _listItems = (from x in _orgList
.SelectMany(x => x.ListObjects, (Product, Param) =>
new { Product, Param })
select new { }

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.