Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0609 

Error Message

Cannot set the IndexerName attribute on an indexer marked override

The name attribute (IndexerNameAttribute) cannot be applied to an indexed property that is an override. For more information, see Indexers.

The following sample generates 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 )
   {
   }
}

Community Additions

ADD
Show:
© 2014 Microsoft