編譯器錯誤 C2364
'type':自訂屬性的型別不合法
自定義屬性的具名自變數僅限於編譯時間常數。 例如,整數類型(int、char 等)、System::Type^和 System::Object^。
範例
下列範例會產生 C2364。
// c2364.cpp
// compile with: /clr /c
using namespace System;
[attribute(AttributeTargets::All)]
public ref struct ABC {
public:
// Delete the following line to resolve.
ABC( Enum^ ) {} // C2364
ABC( int ) {} // OK
};