Skip to content

LockableSlim

Jordan Duerksen edited this page May 15, 2018 · 5 revisions

LockableSlim uses a System.Threading.ReaderWriterLock to provide thread-safe access to an underlying value

Use

using W;

public class LockableSlim<TValue>
{
    public TValue Value {get; set;}
}
//declare instance
protected LockableSlim<int> SomeInt { get; } = new LockableSlim<int>();

You can pass in an initial value to the constructor:

public LockableSlim<string> Username { get; } = new LockableSlim<string>("Test User");

Clone this wiki locally