Instead of doing:
using(MyDataContext db = new MyDataContext())
{
//do something
}
I'd like to use an Action()
public static class SimpleUsing
{
public static void DoUsing(Action action)
{
using(MyDataContext db = new MyDataContext())
{
//do something
}
}
}
Which would be used as
SimpleUsing.DoUsing(() =>
{
//but how to get DataContext variable?
}
The main issue is how do I access the "db" variable to make use of the DataContext?