Actually do not use this thing, only do understand
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespaceIndexer {classProgram {Static voidMain (string[] args) {Person P=NewPerson (); p[0] =1; p[1] =2; p[2] =3; p[3] =4; p[4] =5; foreach(varIteminchp.numbers) {Console.WriteLine (item); } p["0"] ="1"; p["1"] ="2"; p["2"] ="3"; p["3"] ="4"; p["4"] ="5"; Console.WriteLine (p["0"]); Console.ReadLine (); } } classPerson {Private int[] _numbers =New int[5]; Public int[] Numbers {Get{return_numbers;} Set{_numbers =value;} } //Indexer, which allows an object to manipulate an array in an indexed manner Public int This[intIndex] { Get{return_numbers[index];} Set{_numbers[index] =value;} } Dictionary<string,string> dic =Newdictionary<string,string>(); Public string This[stringIndex] { Set{Dic[index] =value;} Get{returnDic[index];} } }}
The indexer of C #