Error del compilador CS0678

Actualización: noviembre 2007

Mensaje de error

'variable': un campo no puede ser tanto volátil como de sólo lectura
'variable': a field can not be both volatile and readonly

El uso de las palabras clave volatile y readonly se excluye mutuamente.

El código siguiente genera el error 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()
   {
   }
}