I am new to LINQ and am trying to create a collection say "DBDatalog" of only one column DCID and then converting that collection to datatable.
var DBDatalog = from records in this.Points
where records.UsesLegacyStorage == false
select new
{
DcId = records.DCId,
};
I want to be able to do something like this
DataTable dt = new DataTable();
dt.Columns.Add("DCId", typeof(Int32));
AND for the contents of DataTable
DataTable dataTable = DBDatalog.toDataTable();
But that is not working. How can I convert my collection set attained in the dbdatalog to convert to data table.
Points is a list of objects defined like this public List Points = new List(); and Exports is defined like this.
public class ExportPoint
{
public int DCID;
public int BuildingId;
public string BuildingName;
}