Sdílet prostřednictvím


Compilerfehler CS0633

Aktualisiert: November 2007

Fehlermeldung

Das Argument für das "Attribut"-Attribut muss ein gültiger Bezeichner sein.
The argument to the 'attribute' attribute must be a valid identifier

Jedes an das ConditionalAttribute-Attribut oder das IndexerNameAttribute-Attribut übergebene Argument muss ein gültiger Bezeichner sein. Daher darf es keine Zeichen wie z. B. "+" enthalten, weil diese in Bezeichnern unzulässig sind.

Beispiel

In diesem Beispiel wird der Fehler CS0633 anhand von ConditionalAttribute veranschaulicht. Im folgenden Beispiel wird CS0633 generiert:

// CS0633a.cs
#define DEBUG
using System.Diagnostics;
public class Test
{
   [Conditional("DEB+UG")]   // CS0633
   // try the following line instead
   // [Conditional("DEBUG")]
   public static void Main() { }
}

In diesem Beispiel wird der Fehler CS0633 anhand von IndexerNameAttribute veranschaulicht.

// CS0633b.cs
// compile with: /target:module
#define DEBUG
using System.Runtime.CompilerServices;
public class Test
{
   [IndexerName("Invalid+Identifier")]   // CS0633
   // try the following line instead
   // [IndexerName("DEBUG")]
   public int this[int i] 
   { 
      get { return i; } 
   }
}