NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error CS0605

Public constructor 'constructor' of class marked attribute has arguments that are not attribute types

In a user-defined attribute, the class constructor can only take parameters of the following types: bool, byte, char, decimal, double, float, int, long, short, System.Variant, string, System.Type, enum (provided that it has public accessibility and that the types in which it is nested (if any) also have public accessibility), and an array type with a rank of one and an element type that is one of the types listed above. (Note that the type int[] is an attribute parameter type, but the type int[][] is not.)

The following sample generates CS0605:

using System;
public struct S {
}

[attribute]
public class PublicBadType {
   // The following constructor is allowed
//   public PublicBadType(string ui, int ii) {
//   }
// the following constructors generate CS0605
   public PublicBadType(object o) {}
   public PublicBadType(S s) {}
   public PublicBadType(int[][] aai) {}
   public PublicBadType(System.UInt32 ui) {}
   public PublicBadType(object[] ao) {}
   public PublicBadType(int[,] aai) {}

   public static void Main () {
   }
}

See Also

Attributes