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: For a general solution, see:
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); }
Comments
Post a Comment