How can I detect whether an object is locked or not?
Monitor.TryEnter (as described in Is there a way to detect if an object is locked?) does not work f
Monitor.TryEnter
Monitor.IsEntered should do the trick.
Edit: I just re-read the documentation, and it says:
Determines whether the current thread holds the lock on the specified object.
So that is not sufficient, as you would probably like to know if a different thread holds a lock?