Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Array manipulation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Array manipulation

    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

    #2
    >> 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).
    DierkNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by StockTrader88, Today, 07:58 AM
    0 responses
    1 view
    0 likes
    Last Post StockTrader88  
    Started by varsha, Yesterday, 06:33 PM
    1 response
    25 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by aytacasan, Today, 07:03 AM
    2 responses
    9 views
    0 likes
    Last Post aytacasan  
    Started by RobotSyndicate, 01-11-2021, 03:46 PM
    6 responses
    82 views
    0 likes
    Last Post timko
    by timko
     
    Started by MarkF60, Today, 05:25 AM
    0 responses
    5 views
    0 likes
    Last Post MarkF60
    by MarkF60
     
    Working...
    X