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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Overhead of using ArrayLists and Hashtables in C#

Thread ID:




7487 Sep 26,2003 12:06 PM UTC WinForms 0
Tags: FAQ
Asked On September 26, 2003 12:06 PM UTC

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


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon