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 // fuck this way
{
get
{
;
lock (this)
return shitMethod;
}
set
{
;
lock (this)
shitMethod = value;
}
}
}