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 CS0606

The type of public instance field 'instance' in class marked attribute does not have attribute type

In a user-defined attribute, a public instance 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 CS0606:

using System;
public struct S {
}
[attribute]
public class PublicBadType {
   // the following line is a valid instance
   // public int i;
   
   // the following declarations generate CS0606
   public object o;
   public S s;
   public int[][] aai;
   public System.UInt32 ui;
   public object[] ao;
   public int[,] a2i;

   public static void Main () {
   }
}