We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Overhead of using ArrayLists and Hashtables in C#

Thread ID:

Created:

Platform:

Replies:

7487 Sep 26,2003 08:06 AM Windows Forms 0
loading
Tags: FAQ
Mike
Asked On September 26, 2003 08:06 AM

Hi - I am really getting dynamic with my form and control creation from a backend schema and building the controls on the fly from a DataSet. I need to reference the objects I create in methods and because the control is declared locally in each method e.g. CreateTextBox() { TextBox tb = new TextBox(); // set properties } I need to later reference this object. I was thinking of putting my controls in both Hashtables for immediate reference by a key and into an ArrayList to decide which controls are bound to the database. My question is, since both of these objects hold references to control object I create - is there much overhead to do this? Having say 100 controls instantiated, then added to the form, then added to a Hashtable and finally to an ArrayList. Does the ArrayList and Hashtable cause much memory allocation or are they just pointers to the memory address of those objects and therefore could be considered lightweight? thanks for your expertise - much appreciated mike

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;