コンパイラ エラー CS0609

更新 : 2007 年 11 月

エラー メッセージ

override として指定されたインデクサに IndexerName 属性を設定することはできません。

名前属性 (IndexerNameAttribute) は、オーバーライドであるインデックス付きプロパティには適用できません。詳細については、「インデクサ」を参照してください。

次の例では 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 )
   {
   }
}