Answers for "c# indexer"

C#
1

c# indexer

class SampleCollection<T>
{
   // Declare an array to store the data elements.
   private T[] arr = new T[100];

   // Define the indexer to allow client code to use [] notation.
   public T this[int i]
   {
      get { return arr[i]; }
      set { arr[i] = value; }
   }
}
Posted by: Guest on May-24-2021

C# Answers by Framework

Browse Popular Code Answers by Language