DynamicDataTable, Part 2

The next thing we want for our dynamic DataTable is to do calculations between one or more columns. Imagine (for instance) that you want to add two columns and store the result in a third. In C#, the client code might look like this: dynamic table = new DynamicDataTable(t); table.Foo = table.Bar + table.Baz; At…

1

DynamicDataTable, Part 1

Let’s get started by doing “the simplest thing that could possibly work”. public class DynamicDataTable : DynamicObject { private readonly DataTable _table; public DynamicDataTable(DataTable table) { _table = table; } } For now, we’ll use a DataTable for the actual storage and a DynamicObject to provide an implementation of IDynamicMetaObjectProvider. What can we accomplish with…

2

DynamicDataTable, Part 0

To commemorate the first beta release of the first CLR to contain the DLR, I’m going to try to implement something more interesting than useful – a dynamic version of the DataTable class. My goal is to show how the dynamic support in C#4 and VB10 can be used to create a better development experience,…

1