But if we’re using generics; why not do it for the lock too:
1: public class ImportantProvider<T,L> where T : ImportantInterface, new() where L : Lock,new()
3: private T _importantObject = new T();
4: private L _lock = new L();
6: public Transaction Transaction
10: return new Transaction(_importantObject, _lock);
But that leads to test code with static fields for verification. And I didn’t like that before either… So it is a good idea to back that change out event though the ImportantProvider looks very neat with it IMHO.