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
  • 856
  • 1
  • 12
  • 26

1 Answers1

1

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

SLaks
  • 800,742
  • 167
  • 1,811
  • 1,896