共用方式為


編譯器錯誤 CS1551

更新:2007 年 11 月

錯誤訊息

索引子至少必須有一個參數

已宣告不使用任何引數的索引子

下列範例會產生 CS1551:

// CS1551.cs
public class MyClass
{
   int intI;

   int this[]   // CS1551
   // try the following line instead
   // int this[int i]
   {
      get
      {
         return intI;
      }
      set
      {
         intI = value;
      }
   }

   public static void Main()
   {
   }
}