对于更完整/更详细的内容:
对32位值类型的读写是原子的:这包括以下固有值(结构)类型:
bool, char, byte, sbyte, short, ushort, int,uint, float。以下类型(以及其他类型)不保证是原子类型:
decimal, double, long, ulong。
例如
int x;x = 10; // atomicdecimal d;d = 10m; // not atomic
引用分配也是一个原子操作:
private String _text;public void Method(String text){ _text = text; // atomic}


