c# 4.0 - Can we convert the list into DataTable in C#? -


Can anyone tell me how to change in the list table in C #?

Do you mean normally? There is no automated way to do this.

But you can do it yourself manually:

  class person {get public ent ID}; Set;} public string first name {get; Set;} ...} var personsList = new list & lt; Person & gt; (); Var datatable = new datatale (); DataTable.Columns.Add ("ÏD", typef (int)); DataTable.Columns.Add ("First name", typef (string)); ... foreach (individual individuals) {dataTable.Rows.Add (person.ID, person.FirstName ...)}  

Comments