VB.NET overloading array access?
- by Wayne Werner
Hi,
Is it possible to overload the array/dict access operators in VB.net? For example, you can state something like:
Dim mydict As New Hashtable()
mydict.add("Cool guy", "Overloading is dangerous!")
mydict("Cool guy") = "Overloading is cool!"
And that works just fine. But what I would like to do is be able to say:
mydict("Cool guy") = "3"
and then have 3 automagically converted to the Integer 3.
I mean, sure I can have a private member mydict.coolguy and have setCoolguy() and getCoolguy() methods, but I would prefer to be able to write it the former way if at all possible.
Thanks