DataGridView bound to a Dictionary

Or, in LINQ, it’s nice and quick:

var _priceDataArray = from row in _priceData select new { Item = row.Key, Price = row.Value };

That should then be bindable, to the columns ‘Item’ and ‘Price’.

To use it as a data source in a grid view, you just have to follow it with ToArray().

dataGridView1.DataSource = _priceDataArray.ToArray();

Leave a Comment