How I Call this indexer in main class for differ in variable i,x,y
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- using System;
- class SampleCollection
- {
-
- private T[] arr = new T[100];
- private P[] prr = new P[100];
- private U[] urr = new U[100];
-
- public T this[int i]
- {
- get { return arr[i]; }
- set { arr[i] = value; }
- }
-
- public P this[int x]
- {
- get { return prr[x]; }
- set { prr[x] = value; }
- }
-
- public U this[int y]
- {
- get { return urr[y]; }
- set { urr[y] = value; }
- }
- }
- class Program
- {
- static void Main()
- {
- var stringCollection = new SampleCollection();
- for (int i = 0; i < 200;i++ )
- {
- stringCollection[i] = new {"Hello, World",1,1};
- Console.WriteLine(stringCollection[i]);
- }
- Console.ReadKey();
- }
- }
-
-
- }