編譯器錯誤 C3342
'attribute': 屬性有多個定義,導致模稜兩可
編譯器發現屬性有多個定義。
屬性重複定義。
如需詳細資訊,請參閱 User-Defined Attributes。
範例
下列範例會產生 C3342。
// 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 {};