title: Struct array initialization inside class ASP.NET MVC
body: <p>I have a problem with initialization of array in class array, I have a SearchArrayModel:</p>
  
  <pre><code>public class SearchArrayModel
  {
      public struct AttribStruct
      {
          public string AttribName { get; set; }
          public string[] AttribValues { get; set; }
      }
      public AttribStruct[] AttribArray { get; set; }
  }
  </code></pre>
  
  <p>and I have a controller to fill the arrays:</p>
  
  <pre><code>SearchArrayModel[] src = new SearchArrayModel[1]
  {
      new SearchArrayModel()
      {
          AttribArray = new SearchArrayModel.AttribStruct[]
          {
              new SearchArrayModel.AttribStruct
              {
                  AttribName = atributes2.attribname, //it's in foreach loop, but it's a string value
                  AttribValues = new string[] 
                  {
                      values.ToString() //another string values
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>And my view:</p>
  
  <pre><code>@model allegrotest.Models.SearchArrayModel
  @{
      ViewBag.Title = "ShowItems";
  }
  
  @using (Html.BeginForm())
  {
      @foreach (var item in Model.AttribArray)
      {
          foreach (var item2 in item.AttribName)
          {
              &lt;h2&gt;@item2&lt;/h2&gt;
          }
      }
  }
  </code></pre>
  
  <p>Is it correct? I want to display all the elements from AttribArray, but in my View I have just one element</p>
  
  <p>or maybe I have sth wrong in my foreach loops..</p>