Teilen über


Compilerfehler C3342

'attribut': Mehrdeutiges Attribut

Bemerkungen

Der Compiler hat mehr als eine Definition eines Attributs gefunden.

Ein Attribut wurde mehrmals definiert.

Weitere Informationen finden Sie unter User-Defined Attributes.

Beispiel

Im folgenden Beispiel wird C3342 generiert.

// C3342.cpp
// compile with: /clr /c
using namespace System;
using namespace System::Reflection;

[AttributeUsage(AttributeTargets::All)]
public ref class XAttribute : public  Attribute {};

[AttributeUsage(AttributeTargets::All)]
public ref class X : public Attribute {};

[X]   // C3342 could refer to X or XAttribute
// try the following line instead
// [XAttribute]
public ref class Class4 {};