c# - Converting anonymous type to DataTable -


What is the fastest way to convert an anonymous type into DataTable?

Update: I have to obtain and populate databases with anonymous type. If the reflection is ncensory, how can I do this by reflection?

found:

  var results in p = cities in data sources In p.City p. Select new {property1 = cities.Key, property 2 = cities Average (p = & gt; p.age)}; Dt.Columns.Add ("Property1"); Dt.Columns.Add ("Property2"); Foreign currency (different items in result) {dt.Rows.Add (item.Property1, item.Property2); }   

For a general solution, see:

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -