編譯器錯誤 C3099
'keyword': 對 Managed 屬性使用 [System::AttributeUsageAttribute];對 WinRT 屬性使用 [Windows::Foundation::Metadata::AttributeUsageAttribute]
用來 AttributeUsageAttribute 宣告 /clr 屬性。 使用 Windows::Foundation::Metadata::AttributeUsageAttribute
宣告 Windows 執行階段屬性。
如需 /CLR 屬性的詳細資訊,請參閱 使用者定義的屬性。 如需 Windows 執行階段 中支持的屬性,請參閱 Windows.Foundation.Metadata 命名空間
範例
下列範例會產生 C3099,並示範如何修正此問題。
// C3099.cpp
// compile with: /clr /c
using namespace System;
[usage(10)] // C3099
// try the following line instead
// [AttributeUsageAttribute(AttributeTargets::All)]
ref class A : Attribute {};