Export (0) Print
Expand All
Expand Minimize

Compiler Error CS1620 

Error Message

Argument 'number' must be passed with the 'keyword' keyword

This error occurs if you are passing an argument to a function that takes a ref or out parameter and you don't include the ref or out keyword at the point of call, or you include the wrong keyword. The error text indicates the appropriate keyword to use and which argument caused the failure.

The following sample generates CS1620:

// CS1620.cs
class C
{
    void f(ref int i) {}
    public static void Main()
    {
        int x = 1;
        f(out x);  // CS1620 – f takes a ref parameter, not an out parameter
        // Try this line instead:
        // f(ref x);
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft