Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Generic Multi-dimensional List

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

    Generic Multi-dimensional List

    NT Team,

    Please confirm if there is a better way to initialize a generic list with three dimensions than the code below:

    Code:
    #region Using declarations
    using System.Collections.Generic;
    #endregion
    
    namespace NinjaTrader.Indicator
    {
      public class TEST : Indicator
      {
        #region Variables
          private string sOutput;    
          private List<List<List<double>>> MDList = new List<List<List<double>>>();
          private List<List<double>> SubList = new List<List<double>>();    
        #endregion
    
        protected override void Initialize()
        {
          for (int i = 1; i < 4; i++) {
            SubList.Add (new List<double>(new double[]{(i*10+1),(i*10+2),(i*10+3)}));
          }
          for (int i = 0; i < 3; i++) {      
            MDList.Add (SubList);
          }
        }
    
        protected override void OnBarUpdate()
        {
          sOutput = "";
          for (int i=0; i < 3; i++) {
            sOutput = sOutput + i.ToString() + Environment.NewLine;
            for (int j=0; j < 3; j++) {
              for (int k=0; k < 3; k++) {
                sOutput = sOutput + MDList[i][j][k] + "\t";
              }
              sOutput = sOutput + Environment.NewLine;
            }
          }
          Print ("");
          Print (sOutput);
        }
      }
    }
    Regards
    Shannon

    #2
    I think there is not a better way. But in case you know the number of list-elements in advance, then you could use a multi-dimensional standard array. And if you know the values in advance (constants), then you could initialize that array in one single step.

    Regards
    Ralph

    Comment


      #3
      Thanks Ralph,

      Here's an extension to the question. In the below code a 3x4x5 (i x j x k) list is created, populated and displayed. The problem is in the third element, it appears to set the all recorded third elements equal to the last (reflected as in hundreds below). As in the below capture from the Output window:
      0
      400 401 402
      410 411 412
      420 421 422
      430 431 432
      1
      400 401 402
      410 411 412
      420 421 422
      430 431 432
      2
      400 401 402
      410 411 412
      420 421 422
      430 431 432
      3
      400 401 402
      410 411 412
      420 421 422
      430 431 432
      4
      400 401 402
      410 411 412
      420 421 422
      430 431 432

      Code:
      #region Using declarations
      using System.Collections.Generic;
      #endregion
      
      namespace NinjaTrader.Indicator
      {
        public class TEST : Indicator
        {
          #region Variables
            private string sOutput;		
            private List<List<List<double>>> MDList = new List<List<List<double>>>();
            private List<List<double>> SubList = new List<List<double>>();		
            private bool FirstRun = true;
          #endregion
      
          protected override void Initialize()
          {
            for (int j = 0; j < 4; j++) {
              SubList.Add (new List<double>(new double[]{0,0,0}));
            }
            for (int k = 0; k < 5; k++) {			
              MDList.Add (SubList);
            }
          }
      
          protected override void OnBarUpdate()
          {
            if (FirstRun) {
              FirstRun = false;
              for (int i = 0; i < 3; i++) {
                for (int k = 0; k < 5; k++) {
                  for (int j = 0; j < 4; j++) 
                    MDList[k][j][i] = (k*100 + j*10 + i*1); 
                }
              }
              sOutput = "";
              for (int k=0; k < 5; k++) {
                sOutput = sOutput + k.ToString() + Environment.NewLine;
                for (int j=0; j < 4; j++) {
                  for (int i=0; i < 3; i++)
                    sOutput = sOutput + MDList[k][j][i] + "\t";
                  sOutput = sOutput + Environment.NewLine;
                }
              }
              Print ("");
              Print (sOutput);
            }			
          }
        }
      }
      As always any advice would be much appreciated.

      Regards
      Shannon

      Comment


        #4
        Shansen,

        I am happy to assist.

        Essentially, I believe you are looking for nested lists. Please find a link below for more information on this.

        Use a nested List to store data in two dimensions. Nested lists are like jagged or 2D lists.


        Please let me know if I can assist further.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Adam,

          Thank you for the quick response. You are correct in that the question deals with generic nested lists. The code performs as expected with two nested lists, as evidenced by the Output of the elements "i" and "j". In each "i-j" matrix, "i" increases from 0 to 2 and "j" increases from 0 to 3.

          The issue appears to solely effect "k" as evidenced in the series of "i-j-k" matrices, "k" fails to increase from 0 to 4 but instead is "stuck" on the final value 4 in each matrix, while correctly outputing the value of "k" in the numbering of each matrix.

          While one possible solution may be to align the order in which each element is input and subsequently output. This simplified code has been constructed to mirror the constraints of a slightly more complicated indicator. In the below simplified code, the order in which "i", "j" & "k" values are input are deliberatly different to the order in which they are output.

          If you are able, please reconsider the question.
          Regards
          Shannon

          Comment


            #6
            Hello Shannon,

            I am not sure why your test indicator is not operating as expected. But there is one suspicious point: You fill your array in a different order compared to how you read its content.

            If the dimensions of your array are fixed, then I would use a simple array instead of the lists:
            double[,,] arr = new double[3,4,5];

            Regards
            Ralph

            Comment


              #7
              Shansen,

              Unfortunately this level of coding is unsupported. In mathematics even things done in 3D space only use matrices which are always 2 dimensional. I would suggest looking at what you want to accomplish and consider ways to do it with 2D arrays/lists. If this is genuinely not possible, try to specifically reference items in your 3D list outside of the for loop.

              I would also suggest starting with a simple example, such as a 2x2x2 list/array or something and see if you can reference all items without issues.

              General debugging procedures include liberal use of print statements to ensure values are as expected, as well as comments to comment out code piece by piece and add them piece by piece until you notice the where the issue is.
              Last edited by NinjaTrader_AdamP; 10-17-2011, 11:16 AM.
              Adam P.NinjaTrader Customer Service

              Comment


                #8
                Adam,

                Thanks again for the response.

                Incorporating each of your suggestions leads to the below output.
                1. As the 2x2x2 generic list is populated an entry check sequentially prints each element's contents
                2. An Output is produced without loops, a "Manual Output"
                3. The order of population of the list is aligned with the order of output of the list, a "Looped Output".

                Please note, for example the first element [0][0][0] on entry is correctly "000", at output the element (via manual or looped output) has changed to "100". I am of the understanding it is possible to use generic lists in the fashion, but it escapes me. Any advice or direction would be greatly appreciated.
                Entry check
                [0][0][0] = 000
                [0][0][1] = 001
                [0][1][0] = 010
                [0][1][1] = 011
                [1][0][0] = 100
                [1][0][1] = 101
                [1][1][0] = 110
                [1][1][1] = 111

                Manual Output
                [0][0][0] = 100 [0][1][0] = 110
                [1][0][0] = 100 [1][1][0] = 110

                [0][0][1] = 101 [0][1][1] = 111
                [1][0][1] = 101 [1][1][1] = 111

                Looped Output
                [0][0][0] = 100 [0][0][1] = 101
                [0][1][0] = 110 [0][1][1] = 111

                [1][0][0] = 100 [1][0][1] = 101
                [1][1][0] = 110 [1][1][1] = 111

                Code:
                protected override void Initialize()
                {
                  for (int j = 0; j < 2; j++) {
                    AList.Add (0);
                  }
                  for (int j = 0; j < 2; j++) {
                    SubList.Add (new List<double>(AList)); 
                  }
                  for (int k = 0; k < 2; k++) {
                    MDList.Add (new List<List<double>>(SubList));
                  }
                }
                Code:
                if (FirstRun) {
                  FirstRun = false;
                  Print ("Entry check");
                  for (int i = 0; i < 2; i++) {
                    for (int j = 0; j < 2; j++) {
                      for (int k = 0; k < 2; k++) {
                        MDList[i][j][k] = (i*100 + j*10 + k*1); 
                        Print ("[" + i + "]" + "[" + j + "]" + "[" + k + "] = " + MDList[i][j][k].ToString("000"));
                      }
                    }
                  }
                
                  Print ("");  
                  Print ("Manual Output");  
                  Print ("[0][0][0] = " + MDList[0][0][0] + "\t" +"[0][1][0] = " + MDList[0][1][0]);
                  Print ("[1][0][0] = " + MDList[1][0][0] + "\t" +"[1][1][0] = " + MDList[1][1][0]);
                  Print ("");
                  Print ("[0][0][1] = " + MDList[0][0][1] + "\t" +"[0][1][1] = " + MDList[0][1][1]);
                  Print ("[1][0][1] = " + MDList[1][0][1] + "\t" +"[1][1][1] = " + MDList[1][1][1]);  
                
                  Print ("");
                  Print ("Looped Output");
                  sOutput = "";
                  for (int i = 0; i < 2; i++) {
                    for (int j = 0; j < 2; j++) {
                      for (int k = 0; k < 2; k++) {
                        sOutput = sOutput + "[" + i + "]" + "[" + j + "]" + "[" + k + "] = " + MDList[i][j][k] + "\t";
                      }
                      sOutput = sOutput + Environment.NewLine;
                    }
                    sOutput = sOutput + Environment.NewLine;
                  }  
                  Print (sOutput);
                }
                Thanks again.
                Shannon

                Comment


                  #9
                  Originally posted by NinjaTrader_AdamP View Post
                  ...Unfortunately this level of coding is unsupported...
                  It is, of course, supported in C# and C++.

                  Comment


                    #10
                    Here is the most simple implementation I can think of. The example indicator uses a 3-dim-array, containing 2 elements in each dimension:
                    Code:
                    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]#region[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Variables[/SIZE][/FONT]
                    [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] i, j, k;[/SIZE][/FONT]
                    [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][,,] array3Dim = {{{[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]10[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]20[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]},{[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]30[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]40[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]}},{{[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]50[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]60[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]},{[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]70[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]80[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]}}};[/SIZE][/FONT]
                    [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]#endregion[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
                     
                    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] OnStartUp()[/SIZE][/FONT]
                    [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
                    [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff] for[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (i = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; i < [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; i++)[/SIZE][/FONT]
                    [SIZE=2][FONT=Courier New] {[/FONT][/SIZE]
                    [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]   for[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (j = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; j < [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; j++)[/SIZE][/FONT]
                    [SIZE=2][FONT=Courier New]   {[/FONT][/SIZE]
                    [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]     for[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (k = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; k < [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; k++)[/SIZE][/FONT]
                    [SIZE=2][FONT=Courier New]       Print([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"i:"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] + i + [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]" j:"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] + j + [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]" k:"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] + k + [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]" element: "[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] + array3Dim[i,j,k]);[/SIZE][/FONT]
                    [SIZE=2][FONT=Courier New]   }[/FONT][/SIZE]
                    [SIZE=2][FONT=Courier New] }[/FONT][/SIZE]
                    [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
                    [/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
                    The output of the print statement is:
                    Code:
                    i:0 j:0 k:0 element: 10
                    i:0 j:0 k:1 element: 20
                    i:0 j:1 k:0 element: 30
                    i:0 j:1 k:1 element: 40
                    i:1 j:0 k:0 element: 50
                    i:1 j:0 k:1 element: 60
                    i:1 j:1 k:0 element: 70
                    i:1 j:1 k:1 element: 80
                    Attached Files

                    Comment


                      #11
                      Ralph,

                      Thanks for advice. Looks like I will be implementing the array solution.
                      I was hoping to use generic lists for efficiency and consistency with the rest of my coding, but since arrays will solve the problem and should match lists efficiency wise... an array it is.

                      Thanks again
                      Shannon

                      Comment


                        #12
                        In your initial post you used a mixed approach with two lists and one array. You can use lists to manage the task, but the coding effort is quite high and debugging may take some time. If the array dimensions are fixed and you do not need to add/remove/sort elements, than an arry is the better solution. You don't waste memory and the compiler takes care about the access of the multiple dimensions.

                        Comment


                          #13
                          Ralph,

                          Thanks again

                          Shannon

                          Comment


                            #14
                            Ralph,

                            Thanks again for the advice on the three-dimensional (3D) array vs list. The 3D array worked a treat.
                            In an unrelated code I'm working on I'm butting my head against the wall with a similar problem. The code in its current form is a 3D jagged List which uses add() and insert().
                            If at all possible please direct me to an appropriate source so that I may see where I'm going wrong.

                            (BTW thanks for pointing out I had mixed arrays and lists in the thread below. This unnecessary complexity has been removed).

                            Regards
                            Shannon

                            Comment


                              #15
                              Shannon, could you provide an example pointing to the problem?

                              Regards
                              Ralph

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by WHICKED, Today, 02:02 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post WHICKED
                              by WHICKED
                               
                              Started by selu72, Today, 02:01 PM
                              0 responses
                              0 views
                              0 likes
                              Last Post selu72
                              by selu72
                               
                              Started by f.saeidi, Today, 12:14 PM
                              8 responses
                              21 views
                              0 likes
                              Last Post f.saeidi  
                              Started by Mikey_, 03-23-2024, 05:59 PM
                              3 responses
                              49 views
                              0 likes
                              Last Post Sam2515
                              by Sam2515
                               
                              Started by Russ Moreland, Today, 12:54 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Working...
                              X