Kompilatorfel C2364

"type": ogiltig typ för anpassat attribut

Anmärkningar

Namngivna argument för anpassade attribut är begränsade till kompilering av tidskonstanter. Till exempel integraltyper (int, char osv.), System::Type^, and System::Object^.

Example

I följande exempel genereras 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
};