Is it possible to get a thread safe property by using Interlocked
in the property accessors?
Example:
public class A()
{
private static long count;
public static long Count
{
get
{
return Interlocked.Read(ref count);
}
set
{
Interlocked.Exchange(ref count, value);
}
}
}