Expand Minimize
This topic has not yet been rated - Rate this topic

Compiler Error CS0677 

Error Message

'variable': a volatile field can not be of the type 'type'

Fields declared with the volatile keyword must be one of the following types:

  • Any reference type

  • Any pointer type (in an unsafe context)

  • The types sbyte, byte, short, ushort, int, uint, char, float, bool

  • Enum types based on any of the above types

The following sample generates CS0677:

// CS0677.cs
class TestClass
{
   private volatile long i;   // CS0677

   public static void Main()
   {
   }
}
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.