2
Answers

C# Indexed Properties.

twigg

twigg

19y
3.2k
1
I'd like to be able to index into properties but the only way to do this I've been able to see is by using the this[int index] property. The limitation of this is that you can only perform 1 indexed property per class. I'd like to have several properties that are indexable. ex. class MyClass { public float Prop1[int index] { get{} set{} } public float Prop2[int index] { get{} set{} } } however it appears that this is not possible. I then turned to nested classes but that has the limitation that I can't access the members of the NESTING class (unless they're static. No use) Has anyone else found this limitation and what are some workarounds?
Answers (2)