ked()*System.Thread+,-./6$\n1Monitor2%3ef'\r6() CompareExchangebDecrementbExchange> Increment [K%8&Zhi)j\rk$lminop'\rlncrement^ Decrement2hijkqr1 st1 uvwx_$yz'\r1 class Example\r2 (\rprivate int a=l;\r4\r5 public void AddOne ()\r6 (\rint newA=Interlocked.Increment(ref a);\r8 }\r9 }\rExchangejkq{|}z'\r1 public void SetData ()\r2 (\rInterlocked.Exchange(ref a,100);\r4 )\rCompareExchange2%~ij860*if $%& a [*1 ]100}za'\r1 public void CompareAndExchange ()\r2 (\r3 Interlocked.CompareExchange(ref a,100,1);\r4 ).\rGHI\r@P`"VW\nK!v8&9$P\r3 $¡¢'\r)£%¤¥¦$].§¨©ª$@P8=«¬®¯°>` $±²³´©\rN©µ¶$q8·¸¹º'\r`.NET»¼$½¾¸r¿ÀÁÂÃQÄÅ".NETÆP” ÈÃL