By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,330 Members | 1,262 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,330 IT Pros & Developers. It's quick & easy.

Memory/performance efficient collection with fixed size and supporting several types?

P: n/a
DC
Hi,

I currently use a SortedList for something like this:

public class DataRow : SortedList
{

public DataRow() : base(3)
{
Add("id", (int)-1);
Add("Name", "");
Add("Value", 0);
// ... this list must be expandable (but only through changing code)
}
}

Now I can use enumerations and access my data via a string index,
which is all the SortedList functionality I require:

Datarow d = new DataRow();
//...
foreach (object foo in d)
//...
int id = d["id"];
I tried the same with a Hashtable but the memory requirements killed
my app. Question: can I use a better (standard) class here? I am also
thinking about using a truely simple class like:
public class DataRow
{
public int id = 0;
public string Name = "";
public Value = 0;

}

However, the Indexer would be a huge switch statement and I don't know
how to implement an enumerator here.

Thanks for any hint in advance.

Regards

DC
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.