Operator[] index overload in C#
-
Hi Guys, I need to make an overload for the index operator[int x] for an System.Collection.ArrayList, to use the get/set methods on it to return/set the specific item in that list. How do i declare it ? i tried :
public static explictit operator[int x] { }
It doesn't work. Help. Kind regards, Alex“Be the change you want to see in the world.”
-
Hi Guys, I need to make an overload for the index operator[int x] for an System.Collection.ArrayList, to use the get/set methods on it to return/set the specific item in that list. How do i declare it ? i tried :
public static explictit operator[int x] { }
It doesn't work. Help. Kind regards, Alex“Be the change you want to see in the world.”
al3xutzu00 wrote:
I need to make an overload for the index operator[int x]
It isn't an operator. It is an indexer. You can read about how to create them here: Using Indexers (C# Programming Guide)[^]
*Developer Day Scotland - Free community conference Delegate Registration Open