LINQ: List of Lists to flattern

Lots of code contains list of lists or dictionary of lists data objects.
Quite often we need to extract a flattern list of data.

The simplest linq staments is

var flatterList = from el in externalList
                  from il in el.innerList
                  select el.code, el.description, il.subcode, il.detailA;

For a complete list of samples, read Use LINQ’s SelectMany Method to “Flatten” Collections .

source: Use LINQ’s SelectMany Method to “Flatten” Collections

Technorati tags: LINQ
Advertisements

Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: