you can use reflection to get the properties of the class and create columns in the DataTable based on them. Then, you can loop through the instances of the class and add them as rows to the DataTable.
This will create a DataTable with columns "Name" and "Age", and two rows of data for John and Jane.
This creates a DataTable with three columns: "ID" (of type int), "Name" (of type string), and "Age" (of type int). It then adds three rows to the DataTable, with values for each of the columns.