-
在CSDN中的定义是:
1 public static string CompareExchange( 2 ref string location1, 3 string value, 4 string comparand 5 )
用locationl与comparand进行比较,如果相等,那么locationl的值就是value的值;如果不等locationl的值就不变。函数等同于一下函数(简单模拟):
1 static string CompareExchange(ref string location1, string value, string comparand) 2 { 3 if(location1==comparand) 4 { 5 location1 = value; 6 } 7 return value; 8 }
时间: 2024-10-11 11:58:15