using System.Data; using System.Linq; namespace Terminal.Gui { /// /// implementation that wraps /// a . This class is /// mutable: changes are permitted to the wrapped . /// public class DataTableSource : ITableSource { private readonly DataTable table; /// /// Creates a new instance based on the data in . /// /// public DataTableSource(DataTable table) { this.table = table; } /// public object this [int row, int col] => table.Rows[row][col]; /// public int Rows => table.Rows.Count; /// public int Columns => table.Columns.Count; /// public string [] ColumnNames => table.Columns.Cast().Select (c => c.ColumnName).ToArray (); } }