FAQ Database Discussion Community


I receive the following error while trying to get the index of a class that inherits from CollectionBase: Cannot apply indexing with []

c#,collectionbase
I have a class that inherits from CollectionBase. public NavigationMenuItemsCollection MenuItems { get; set; } I have a method that is attempting to get the item from the index, but it's not working. public void ActivatePage(int index) { NavigationMenuItem navigationMenuItem = (NavigationMenuItem)MenuItems[0]; } CollectionBase inherits from IList, ICollection, and IEnumerable....