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 CS0646

Cannot specify System.Reflection.DefaultMemberAttribute on type containing an indexer

If a class or other type specifies System.Reflection.DefaultMemberAttribute, it cannot contain an indexed property.

The following sample generates CS0646:

// to resolve, delete System.Reflection.DefaultMemberAttribute or
// remove the indexed property
[System.Reflection.DefaultMemberAttribute("x")]   // CS0646
class MyClass {
   public int this[int index] {   // an indexed property
   // try the following line instead
   // public int prop {
      get { 
         return 0; 
      }
   }

   public int x;
   public static void Main() {
   }
}