[Mono-list] properties with indexers.

Ben Maurer bmaurer@users.sourceforge.net
25 Jul 2003 10:27:52 -0400


On Fri, 2003-07-25 at 10:17, Yves Kurz wrote:
> Hallo..
> 
> maybe anyone of you can help me with this. Is it possible to write
> properties which uses indexers? 
> 
Hello Yves,

I see you are already hacking ;-).

C# does not support this syntax. It only supports having such a syntax
on the class itself.

The best way to support the syntax is to do the following:

public object [] O {
	get {return o;}
}

That will allow the same syntax as you want. You can also return a
collection, there are many examples of this in System.Web, especially in
HttpRequest.

-- Ben