Errore del compilatore CS0609

Aggiornamento: novembre 2007

Messaggio di errore

Impossibile impostare l'attributo IndexerName in un indicizzatore contrassegnato con override.
Cannot set the IndexerName attribute on an indexer marked override

L'attributo del nome (IndexerNameAttribute) non può essere applicato a una proprietà indicizzata che rappresenta un override. Per ulteriori informazioni, vedere Indicizzatori.

Il seguente codice di esempio genera l'errore CS0609:

// CS0609.cs
using System;
using System.Runtime.CompilerServices;

public class idx
{
   public virtual int this[int iPropIndex]
   {
      get
      {
         return 0;
      }
      set
      {
      }
   }
}

public class MonthDays : idx
{
   [IndexerName("MonthInfoIndexer")]   // CS0609, delete to resolve this CS0609
   public override int this[int iPropIndex]
   {
      get
      {
         return 0;
      }
      set
      {
      }
   }
}

public class test
{
   public static void Main( string[] args )
   {
   }
}