Basically I want to achieve using a lock to a property that has no private variable, the goal is to have thread safe Properties instead of doing it manually each time.
But not sure how to write that, so the lines aren't red! :)
public class TestingLOL
{
public int Id { get; set; } // Working non private property but is not thread safe.
public int IdWithLock { get => lock (this); set; } // this is what im trying to achieve without a private property.
private int shitMethod;
public int ShitMethod // **** this way
{
get
{
;
lock (this)
return shitMethod;
}
set
{
;
lock (this)
shitMethod = value;
}
}
}
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)