Action(T) Generic Delegate
Very useful delegate to create anonymous functions…why? This is especially useful when you have repeated code within a function.
This particular example gets a list of tables from a database based on a key that is consumed by the id parameter.
The Action(T) delegate can have zero to several different parameter types.
Action getTables(String id) = delegate() {
List<Tables> lTables = new Select().From<Tables>.Where<Tables.RelatedId>().IsEqualTo(id).ExecuteTypedList<Tables>();
});
Call the function within the function you declared the anonymous function:
getTables(“1”);
That simple…Awesome!
References:
http://msdn.microsoft.com/en-us/library/018hxwa8.aspx


