Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error CS0206
Collapse the table of content
Expand the table of content

Compiler Error CS0206 

Error Message

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. For more information, see Passing Parameters (C# Programming Guide).

Example

The following sample generates CS0206:

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

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

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

Community Additions

ADD
Show:
© 2015 Microsoft