Here is my class:
public class Server
{
public string Name{get;set;}
public void DoTheJob()
{
//MoreCode
}
}
I have created a new instance of Server and I want to make the instance inaccessible while DoTheJob() is running.
Can I do something like this?
DoTheJob()
{
lock(this)
{
//logic
}
}