title: Traversing through list<list<object>> in C#
body: <p>I have a base class like:</p>
  <pre><code>  public class Data
    {
      public double F{ get; set; }
      public double S11R { get; set; }
      public double S21R { get; set; }
      public double S12R { get; set; }
      public double S22R { get; set; }
      public double S11I { get; set; }
      public double S21I { get; set; }
      public double S12I { get; set; }
      public double S22I{ get; set; }
   }
  </code></pre>
  <p>I also have a class like:</p>
  <pre><code>public class VTM
  {
      public VTM()
      {
          Data = new List&lt;List&lt;Data&gt;&gt;();
      }
  
      public List&lt;List&lt;Data&gt;&gt; Data{ get; set; }
  }
  </code></pre>
  <p>I create an instance of VTM in which there are 9 List(let us say they are A, B, C, D,...., I) and, each List has 45 Data instances.</p>
  <p>Based on this class, I need to create another class by iterating through each element. I want to populate SLCTN11 property of VM class which is another type of class defined below.</p>
  <pre><code>public class VM
  {
      public VM()
      {
          SLCTN11= new List&lt;VMData&gt;();
          SLCTN12= new List&lt;VMData&gt;();
          SLCTN21= new List&lt;VMData&gt;();
          SLCTN22= new List&lt;VMData&gt;();
        
      }
      public List&lt;VMData&gt; SLCTN11{ get; set; }
      public List&lt;VMData&gt; SLCTN12{ get; set; }
      public List&lt;VMData&gt; SLCTN21{ get; set; }
      public List&lt;VMData&gt; SLCTN22{ get; set; }
  }
  
  
  
  public class VMData
  {
      public double F{ get; set; }
      public double R1 { get; set; }
      public double R2 { get; set; }
      public double R3 { get; set; }
      public double R4 { get; set; }
      public double R5 { get; set; }
      public double R6 { get; set; }
      public double R7 { get; set; }
      public double R8 { get; set; }
      public double R9 { get; set; }
      public double I1 { get; set; }
      public double I2 { get; set; }
      public double I3 { get; set; }
      public double I4 { get; set; }
      public double I5 { get; set; }
      public double I6 { get; set; }
      public double I7 { get; set; }
      public double I8 { get; set; }
      public double I9 { get; set; }
  }
  </code></pre>
  <p>SLCTN11 is populated based on A,B,C,..,I and they consist of 45 rows each. SLCTN11 defined as follows:</p>
  <pre><code>Vm vm=new VM();
  
  vm.SCLTN11.Add(new VMData(){
     F=A.Data.F,
     R1=A.Data.S11R,
     I1=A.Data.S11I,
     R2=B.Data.S11R,
     I2=B.Data.S11I,
     ...,
     R9=I.Data.S11R,
     I9=I.Data.S11I 
  
  });
  </code></pre>
  <p>I want to accomplish it by iterating through VTM object via two foreaches.</p>
  <pre><code>foreach (var dt in vna.Data)
  {
     //iterates from A to I
     foreach (var data in dt)
     {
         //iterates through 0 to 45 Data objects 
     }
  }
  </code></pre>
  <p>but after iteration for A, I am not sure how to handle the iteration for altering the same SLCTN11 object from B to I to fill out the SCLTN11 list like the above definition.</p>
  <p>thanks in advance.</p>