नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'type': not an attribute; cannot specify [System::AttributeUsageAttribute] or [Windows::Foundation::Metadata::AttributeUsageAttribute]
Remarks
A user-defined managed attribute must inherit from AttributeCollection. A Windows Runtime attribute must be defined in the Windows::Foundation::Metadata namespace.
For more information, see User-Defined Attributes.
Example
The following example generates C3450 and shows how to fix it.
// 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 {};