c# - Get The Full List Of Objects In A Dictionary Values -


i have dictonary:

private dictionary<int, icar> _icarsdic; 

the object icar contains list of objects:

public interface icar  {     int carid { get; set; }     string carname { get; set; }     list<ibrandsdetails> brandsdetails { get; set; } } 

i write function returns me in single list brandsdetails in _icarsdic values.

i sure linq (don't want write ugly loop) i'm new appreciate help. thanks!

use eneumerable.selectmany

list<ibrandsdetails> list =  _icarsdic.selectmany(r => r.value.brandsdetails)                                       .tolist(); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -