This documentation is archived and is not being maintained.

Compiler Error CS0206

A property or indexer may not be passed as an out or ref parameter

A property is not available to be passed as a ref or out parameter.

The following sample generates CS0206:

// CS0206.cs
public class MyClass
{
   public static int iii
   {
      get
      {
         return 0;
      }
      set
      {
      }
   }

   public static void MyMeth(ref int i)
   // public static void MyMeth(int i)
   {
   }

   public static void Main()
   {
      MyMeth(ref iii);   // CS0206
      // try the following line instead
      // MyMeth(iii);   // CS0206
   }
}
Show: