I'm working on a C# project that requires me to keep track of various class objects that I have defined...for instance, class1, class2, etc. Each of these classes has an id that is defined as a Guid.
My current method for tracking all of these objects that I create is to store them into a Hashtable. Below is a sample of what I'm doing.
Hashtable c1_db = new Hashtable();
Hashtable c2_db = new Hashtable();
// class 1
Class1 c1_1 = new Class1(..);
Class1 c1_2 = new Class1(..);
// add class1 objects to database
c1_db.Add(c1_1.id, c1_1);
c1_db.Add(c1_2.id, c1_2);
// class 2
Class2 c2 = new Class2(..);
c2_db.Add(c2.id, c2);
So, basically I use each Guid as the Hashtable key for lookup later on when I need to retrieve my objects.
The question that I have is in regards to my implementation here...is this a good way of handling multiple objects? I'm decently new to C#/OOP so I'm sure there are far better ways of doing so...but this seemed like a decently quick/easy/fast way for me to manage internal data.