title: Index Out of Range in ForEach Loop
body: <p>I am stumped on how a <code>foreach</code> loop could throw an index out of range. 
  I am working with the ebay api to get a list of items. 
  I can verify with QuickWatch in Visual Studio that the collection contains 200 items. </p>
  
  <p>I have searched for duplicate questions, but none matched my case. </p>
  
  <p>My code to retrieve the list of items:</p>
  
  <pre><code>public ItemTypeCollection GetMyActiveItems()
  {
      GetMyeBaySellingCall myEbaySelling = new    GetMyeBaySellingCall(ApiContext);
  
      myEbaySelling.ActiveList = new ItemListCustomizationType();
      myEbaySelling.ActiveList.Sort = ItemSortTypeCodeType.ItemID;
      myEbaySelling.UnsoldList = new ItemListCustomizationType();
      myEbaySelling.UnsoldList.Sort = ItemSortTypeCodeType.ItemID;
      myEbaySelling.SoldList = new ItemListCustomizationType();
      myEbaySelling.SoldList.Sort = ItemSortTypeCodeType.ItemID;
  
      myEbaySelling.Execute();
      var items = myEbaySelling.ActiveListReturn.ItemArray;
      //checking collection here. I can iterate this just fine. 
      // with no errors. 
      foreach (ItemType item in items)
      {
          var x = item.Title;
      }
      return items; 
  }
  </code></pre>
  
  <p>Then on the Controller I am simply return passing the model to the View: </p>
  
  <pre><code>public ActionResult Items()
  {
      ItemTypeCollection items = service.GetMyActiveItems();
      return View(items);
  }
  </code></pre>
  
  <p>Then on the view, I am simply iterating the items to output to the browser:</p>
  
  <pre><code>@using eBay.Service.Core.Soap;
  
  @model ItemTypeCollection
  
  
  @foreach (ItemType item in Model)
  { // This is where the debugger stops on the first item with Index out of range exception. 
      &lt;div class="col-sm-6 col-md-4"&gt;
          &lt;div class="thumbnail"&gt;
          &lt;h4 class="text-center"&gt;&lt;span class="label label-info"&gt;&lt;/span&gt;&lt;/h4&gt;
          &lt;img src="@item.PictureDetails.PictureURL[0]" class="img-responsive"&gt;
           &lt;div class="caption"&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-md-6 col-xs-6"&gt;
                      &lt;h3&gt;@item.Title&lt;/h3&gt;
                  &lt;/div&gt;
                  &lt;div class="col-md-6 col-xs-6 price"&gt;
                      &lt;h3&gt;
                          &lt;label&gt;@item.BuyItNowPrice.Value.ToString()&lt;/label&gt;
                      &lt;/h3&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;p&gt;@item.SubTitle&lt;/p&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  }
  </code></pre>