C# operator overloading
-
In C#, the indexer for the
ArrayList
class is theItem
property, so you'll have to overload this.
-
What you're looking for is not an operator ("[]"). It's called an indexer (as previously mentioned), and while
ArrayList
does expose anItem
property, the property you'll need to overload (or override) is thethis
property : e.g.public object this[Guid objectKey] { get{...} set{...} } public object this[string objectName] { get{...} set{...} }
I'm not sure what your plan for this is, but you may also want to consider implementing the ICollection interface (probably the CollectionBase class) if you're working on making a strongly typed collection. It uses an ArrayList internally. Hope this helps.The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’