Is C# += thread safe?

No it isn’t thread safe since it’s equivalent to:

int temp = orig + value;
orig = temp;

You can use Interlocked.Add instead:

Interlocked.Add(ref orig, value);

Leave a Comment