0

Sorry for bad English.

I need to create and manage a large (not that "large"!) number of controls, through the code. I know how to create them and link the events. The issue is the way of future access to added controls.

Which property works better? ControlCollection.Item[int index] or ControlCollection.Item[string key]?

I think that the time complexity of Item[int] must be O(1), and time complexity of Item[string] must be O(n). Is it right?

h.nodehi
  • 1,036
  • 1
  • 17
  • 32

1 Answers1

1

ControlCollection.this[string] is O(n), except that it caches the most-recently-looked-up name.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964