Error del compilador CS0428

Actualización: noviembre 2007

Mensaje de error

No se puede convertir el grupo de métodos 'Identificador' en tipo no delegado 'tipo'. ¿Intentó invocar el método?
Cannot convert method group 'Identifier' to non-delegate type 'type'. Did you intend to invoke the method?

Este error aparece al convertir un grupo de métodos en un tipo no delegado o al intentar invocar un método sin utilizar los paréntesis.

Ejemplo

En el código siguiente se genera el error CS0428:

// CS0428.cs

delegate object Del1();
delegate int Del2();

public class C
{
    public static C Method() { return null; }
    public int Foo() { return 1; }

    public static void Main()
    {
        C c = Method; // CS0428, C is not a delegate type.
        int i = (new C()).Foo; // CS0428, int is not a delegate type.

        Del1 d1 = Method; // OK, assign to the delegate type.
        Del2 d2 = (new C()).Foo; // OK, assign to the delegate type.
        // or you might mean to invoke method
        // C c = Method();
        // int i = (new C()).Foo();
    }
}