I'd like to know how you know when to lock an entire type
lock (typeof(MyClass))
{
...
}
or an instance
lock (this)
{
...
}
or an object
lock (this._lockObj)
{
...
}
I am asking this because I have a static class that is a simple Wrapper for Enterprise Library 5 and is accessed by multiple components from possibly different threads. The WriteLog() method is locked. I use the type to lock.