'type': 属性ではありません。[System::AttributeUsageAttribute] または [Windows::Foundation::Metadata::AttributeUsageAttribute] を指定できません
ユーザー定義のマネージド属性は AttributeCollection から継承する必要があります。 Windows ランタイム属性は、Windows::Foundation::Metadata
名前空間で定義する必要があります。
詳細については、「 User-Defined Attributes」を参照してください。
例
次の例では、C3450 を生成し、その修正方法を示しています。
// C3450.cpp
// compile with: /clr
// C3450 expected
using namespace System;
using namespace System::Security;
using namespace System::Security::Permissions;
public ref class MyClass {};
class MyClass2 {};
[attribute(AttributeTargets::All)]
ref struct AtClass {
AtClass(Type ^) {}
};
[attribute(AttributeTargets::All)]
ref struct AtClass2 {
AtClass2() {}
};
// Apply the AtClass and AtClass2 attributes to class B
[AtClass(MyClass::typeid), AtClass2]
[AttributeUsage(AttributeTargets::All)]
// Delete the following line to resolve.
ref class B {};
// Uncomment the following line to resolve.
// ref class B : Attribute {};