.NET Fiddle

CSharp · Console

/Program.cs

using System;

public class Program
{
	public static void Main()
	{
		Foo foo = new Foo();
		Console.WriteLine(foo[1]);
	}
}

class Foo
{
	[System.Runtime.CompilerServices.IndexerName("TheItem")] 
	public int this[int i]
	{
		get
		{
			return i;
		}

		set
		{
		}
	}
}
;