How to add data to DataGridView

后端 未结 5 1781
野的像风
野的像风 2021-01-02 10:09

I\'m having a Structure like

 X={ID=\"1\", Name=\"XX\",
    ID=\"2\", Name=\"YY\" };

How to dump this data to a DataGridView o

5条回答
  •  天命终不由人
    2021-01-02 10:31

    LINQ is a "query" language (thats the Q), so modifying data is outside its scope.

    That said, your DataGridView is presumably bound to an ItemsSource, perhaps of type ObservableCollection or similar. In that case, just do something like X.ToList().ForEach(yourGridSource.Add) (this might have to be adapted based on the type of source in your grid).

提交回复
热议问题