更新:2007 年 11 月
错误消息
“variable”:一个字段不能同时为 volatile 和 readonly
volatile 和 readonly 关键字的使用是互斥的。
下面的示例生成 CS0678:
// CS0678.cs
using System;
class TestClass
{
private readonly volatile int i; // CS0678
// try the following line instead
// private volatile int i;
public static void Main()
{
}
}