How do I take a DataTable and convert it to a List?
I\'ve included some code below in both C# and VB.NET, the issue with both of these is that we create a new object
Do you want to reference the rows of the table? In that case you should use the DataTable.Rows property.
Try this:
notes.AddRange(table.Rows);
If the table rows implement INote then this should work.
Alternatively you could do as you did above:
foreach (INote note in table.Rows)
{
notes.Add(note)
}