Compilerfehler CS1910

Aktualisiert: November 2007

Fehlermeldung

Ein Argument vom Typ "Typ" ist für das DefaultValue-Attribut nicht zutreffend
Argument of type 'type' is not applicable for the DefaultValue attribute

Für Parameter des Typs Objekt muss das Argument des DefaultParameterValueAttributenull, ein integraler Typ, ein Gleitkommawert, bool, string, enum oder char sein. Das Argument kann nicht vom Typ Type und ebenso kein Arraytyp sein.

Beispiel

Im folgenden Beispiel wird CS1910 generiert:

// CS1910.cs
// compile with: /target:library
using System.Runtime.InteropServices;

public interface MyI
{
   void Test([DefaultParameterValue(typeof(object))] object o);   // CS1910
}