CS0646 de erro do compilador

Mensagem de erro

Não é possível especificar o atributo DefaultMember em um tipo que contém um indexador

Se uma classe ou Outros tipo Especifica sistema.reflexão.DefaultMemberAttribute, ele não pode conter um indexador.Para obter mais informações, consulte Propriedades.

O exemplo a seguir gera CS0646:

// CS0646.cs
// compile with: /target:library
[System.Reflection.DefaultMemberAttribute("x")]   // CS0646
class MyClass
{
   public int this[int index]   // an indexer
   {
      get
      {
         return 0;
      }
   }

   public int x = 0;
}

// OK
[System.Reflection.DefaultMemberAttribute("x")]
class MyClass2
{
   public int prop
   {
      get
      {
         return 0;
      }
   }

   public int x = 0;
}

class MyClass3
{
   public int this[int index]   // an indexer
   {
      get
      {
         return 0;
      }
   }

   public int x = 0;
}