Compiler Error CS0655
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

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.

© 2016 Microsoft