Sdílet prostřednictvím


Compilerfehler CS0631

Aktualisiert: November 2007

Fehlermeldung

"ref" und "out" sind in diesem Kontext nicht gültig.
ref and out are not valid in this context

In der Deklaration für einen Indexer dürfen die Parameter ref und out nicht verwendet werden.

Beispiel

Im folgenden Beispiel wird CS0631 generiert:

// CS0631.cs
public class MyClass
{
    public int this[ref int i]   // CS0631
    // try the following line instead
    // public int this[int i]
    {
        get
        {
            return 0;
        }
    }
}

public class MyClass2
{
    public static void Main()
    {
    }
}