Compiler Error C3101
illegal expression for named attribute argument 'field'
When initializing a named attribute argument, the value must be a compile time constant.
For more information on attributes, see User-Defined Attributes.
Example
The following sample generates C3101.
// C3101.cpp
// compile with: /clr /c
ref class AAttribute : System::Attribute {
public:
int Field;
};
extern int i;
[assembly:A(Field = i)]; // C3101
[assembly:A(Field = 0)]; // OK
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for