Export (0) Print
Expand All
Expand Minimize

Compiler Error C3114

Error Message

'argument': not a valid named attribute argument

In order for an attribute class data member to be a valid named argument, it must not be marked static, const, or literal. If a property, the property must not be static and must have get and set accessors.

For more information, see property and User-Defined Attributes.


The following sample generates C3114.

// C3114.cpp
// compile with: /clr /c
public ref class A : System::Attribute {
   static property int StaticProp {
      int get();

   property int Prop2 {
      int get();
      void set(int i);

[A(StaticProp=123)]   // C3114
public ref class R {};

[A(Prop2=123)]   // OK
public ref class S {};

Community Additions

© 2014 Microsoft