Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Compiler Error CS0676

Visual Studio .NET 2003

Cannot pass volatile field 'variable' as ref or out, or take its address

A variable that is marked with the volatile keyword cannot be passed to a ref or out parameter.

The following sample generates CS0676:

// CS0676.cs
using System;

class TestClass
   private volatile int i;

   public void TestVolatile(ref int ii)

   public static void Main()
      TestClass x = new TestClass();
      x.TestVolatile(ref x.i);   // CS0676 don't pass volatile value as ref
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.