PDA

View Full Version : Array manipulation


goldfly
06-30-2007, 11:43 AM
I can use a while loop to move data one direction or another in my (rather large) array.

But isn't there a more efficient way? Something like "OK array, offset everything down three" that would leave the three at the top clear and truncate the last three.

I poked arround the MSDN site and the Clear method would work if I could then sort them but the Sort method only works on one dimnsional arrays

NinjaTrader_Dierk
07-01-2007, 03:58 AM
>> But isn't there a more efficient way?
Not that I know of.

Hints:
a) Rather than moving items you might consider adjustingyour access index by 3. No need to physically move items.
b) If you really want to get rid of the "oldest" items then you might consider looking for an alternate collection like e.g. queue (see MSDN docs).