Poznámka:
Přístup k této stránce vyžaduje autorizaci. Můžete se zkusit přihlásit nebo změnit adresáře.
Přístup k této stránce vyžaduje autorizaci. Můžete zkusit změnit adresáře.
'type': není atribut; nejde zadat [System::AttributeUsageAttribute] nebo [Windows::Foundation::Metadata::AttributeUsageAttribute]
Poznámky
Spravovaný atribut definovaný uživatelem musí dědit z AttributeCollection. V oboru názvů musí být definován Windows::Foundation::Metadata atribut prostředí Windows Runtime.
Další informace naleznete v tématu Uživatelem definované atributy.
Příklad
Následující příklad vygeneruje C3450 a ukazuje, jak jej opravit.
// 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 {};