public Class X { private object _Lock=new object(); private object Var1; private object Var2; // ... public void Add() { lock(_Lock) { //I am doing something related to the current instance. // so other instances of X do not need //to wait for each other. } } }
lock
Monitor
Enter
Leave
TryEnter
_Lock
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)