Alternative to 2-dimension array that needs to get larger?
Alternative to 2-dimension array that needs to get larger?
(OP)
Hi Folks
OK so I'm working on an application where I move data around from one text box to another, and part of what I need to do is keep a record of what data moved from one TextBox to the other.
Since I come from a VB background I figured I would just create a 2-dimensional array and store the Data Text, Starting Box and Ending box as such: X,0 = Data Text, X,1 = Starting Box, X,2 = Ending box where X is the first dimension of the array. To add 'records' I would just ReDim the array and add onto it.
But as I've recently learned you cannot easily (if at all) redimension a multidimensional array in C#. I could simply declare that array to hold the maximum number of possible moves and just deal with the memory overhead, but I'd rather learn something.
I thought about trying to use the ListOf<I> collection but this does not seem to allow more than one value per line. Likewise a Hash Table is just a key/value type of thing.
Any thoughts on what I could do with this? I suppose I could just use a hashtable with one string per unique key that has comma-separated values for the rest of the data, but is there another better option I have not yet discovered?
Thanks
Craig
OK so I'm working on an application where I move data around from one text box to another, and part of what I need to do is keep a record of what data moved from one TextBox to the other.
Since I come from a VB background I figured I would just create a 2-dimensional array and store the Data Text, Starting Box and Ending box as such: X,0 = Data Text, X,1 = Starting Box, X,2 = Ending box where X is the first dimension of the array. To add 'records' I would just ReDim the array and add onto it.
But as I've recently learned you cannot easily (if at all) redimension a multidimensional array in C#. I could simply declare that array to hold the maximum number of possible moves and just deal with the memory overhead, but I'd rather learn something.
I thought about trying to use the ListOf<I> collection but this does not seem to allow more than one value per line. Likewise a Hash Table is just a key/value type of thing.
Any thoughts on what I could do with this? I suppose I could just use a hashtable with one string per unique key that has comma-separated values for the rest of the data, but is there another better option I have not yet discovered?
Thanks
Craig
RE: Alternative to 2-dimension array that needs to get larger?
Sorry, c#...
CODE
ListOf<Dummy>
Rhys
"Technological progress is like an axe in the hands of a pathological criminal"
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe"
Albert Einstein
RE: Alternative to 2-dimension array that needs to get larger?
RE: Alternative to 2-dimension array that needs to get larger?
I jad actually started out by trying to define a class as you suggested but I hadn't put together being able to use the ListOf collection like that. I should have seen that myself. Thanks for the slap to the head!