I am using the following methods:
public void M1(Int32 a)
{
// acquire MyMutex
DoSomething(a);
// release MyMutex
}
and
Yes, it's possible to combine generics with delegates.
public delegate void Action(T x);
public delegate void Action(T x, U y);
public void UsingMutex(Action x, T t) {
// acquire mutex...
x(t);
// release mutex...
}
public void UsingMutex(Action x, T t, U u) {
// acquire mutex...
x(t, u);
// release mutex...
}
But you still have to handle different number of parameters using overloads.