the most easy way: private static object _objState = new object();
method ()
{
lock(_objState)
{
//your codes that cannot be executed at two threads at same time.
}
}
the most easy way: private static object _objState = new object();
method ()
{
lock(_objState)
{
//your codes that cannot be executed at two threads at same time.
}
}