This documentation is archived and is not being maintained.

Compiler Error CS0655

Updated: May 2010

'parameter' is not a valid named attribute argument because it is not a valid attribute parameter type

Positional and named parameters for an attribute class are limited to the following attribute parameter types:

  • One of the following types: bool, byte, char, double, float, int, long, sbyte, short, string, uint, ulong, or ushort.

  • The type object.

  • The type System.Type.

  • An enum type, provided that it has public accessibility, and that any types in which it is nested also have public accessibility.

  • Single-dimensional arrays of the preceding types.

The following sample generates CS0655:

// CS0655.cs
using System;

class MyAttribute : Attribute
    // decimal is not valid attribute parameter type
    public decimal d = 0;
    public int e = 0;

[My(d = 0)]   // CS0655
// Try the following line instead:
// [My(e = 0)]
class C
    public static void Main()




May 2010

Added a list of valid parameter types.

Customer feedback.