We help IT Professionals succeed at work.

Best Way to Manage Multiple objects

dstufft
dstufft asked
on
241 Views
Last Modified: 2010-04-15
I am making an app that is going to work with multiple sets of data.

Im going to use an Class to define what all goes in each set of data, as well as giving methods to work with this data.

If i do not know how many sets of data i am going to be working with, but it could be anywhere from 0 to infinity(ok not really infinite since a computer has a finite number of resources, but i dont know how many sets of data im going to be working with). What is the best way to store all the sets? Would i be better off using one object with the fields being an ArrayList, or would i be better off making a field in my main WinForm that is an Array that will hold multiple objects of the data Class?

Is there a better way then either of these 2?

Thanks
Donald
Comment
Watch Question

You could use a generic List or use a dictionary

By using a dictionary you could supply a key and get the equivalent object
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Top Expert 2007

Commented:
Donald - Can you describe the content of these sets of data? I think we might be able to give you a better fit for your specific needs with a bit more information about the problem.

Jim

Author

Commented:
I'm looking at the solutions already suggested. The Data i am specifically talking about is going to be Account information for logging into an online game. A Basic Listing of What will be required is...

First Name
Last Name
Password
Master-ID (this is a UUID of the account that is allowed to control this account)

Basically this whole program is going to log into the game and allow some remote control via the Private Message function in the game. The Class in question i was planning on using to store the data related to each individual account. The program will need to be able to hold multiple instances of this class because it will need to be able to hold multiple accounts.

Author

Commented:
Sorry,

Forgot to add, i am researching the solutions currently suggested but i am still wide open to any other suggestions.
Arent you using a database to save these records?
Top Expert 2007
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
"Arent you using a database to save these records?"
     My Plan is to Try and Use a Local Database to save the records yes, however i was thinking (and i may be wrong) that i would want to use the Classes to hold the data during runtime, then have a "Save" method that processes the objects and saves them to the dbase.
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks for all your help, it looks like i'm going to make a class that will have an instance for each record, then will have another class that will have one instance that will contain all the instances of the primary class.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.