Udostępnij za pomocą


Błąd kompilatora C3097

"attribute": atrybut musi być o określonym zakresie z atrybutem "assembly:" lub "module:"

Uwagi

Atrybut globalny został użyty niepoprawnie.

Aby uzyskać więcej informacji, zobacz Atrybuty zdefiniowane przez użytkownika.

Przykład

Poniższy przykład generuje kod C3097.

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

[AttributeUsage(AttributeTargets::All, AllowMultiple = true)]
public ref class Attr : public Attribute {
public:
   Attr(int t) : m_t(t) {}
   int m_t;
};

[Attr(10)];   // C3097
[assembly:Attr(10)];   // OK

[Attr(10)]   // OK
public ref class MyClass {};