views:

136

answers:

1

Say the object is as follows:

string Name
Dictionary<string,bool> Tags

Where tags is dynamic, but there is a list of tags stored in a Collection in the core data object.

I want to be able to display this in a datagrid like so:

Name  tag1  tag2 tag3
Bob   true  true
John  true       true

I left out false, but that could be in there if needed.

Cheers

A: 

You can't really do this with LINQ straight up, because you would have to dynamically create the projection, with each key in the Tags collection becoming a property.

I recommend that you create a DataSet, with the columns corresponding to the Tags (plus the Name property) and then the rows corresponding to the instances of your class that you have.

casperOne