title: Razor Foreach model list
body: <p>what I'm trying to do is display each item in a list on a razor page:</p>
  
  <p>_layout.cshtml</p>
  
  <pre><code>&lt;div id="LeftSidebar"&gt;
      &lt;ul&gt;
          @foreach (var x in MenuItems.Items)
          {
              &lt;li&gt;&lt;a href="#"&gt;@x.ItemName &lt;/a&gt;&lt;/li&gt;
          }
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>menu.cs</p>
  
  <pre><code>public class Menu
  {
      public string ItemName { get; set; }
      public string Alt { get; set; }
  
      public Menu()
      {
  
      }
  
      public Menu(string itemName, string alt)
      {
          ItemName = itemName;
          Alt = alt;
      }
  
  }
  
  public class MenuItems
  {
      public static List&lt;Menu&gt; Items = new List&lt;Menu&gt;();
      public MenuItems()
      {
          Items.Add(new Menu
             {
                 Alt = "test item",
                 ItemName = "item 1",
             });
          Items.Add(new Menu
          {
              Alt = "test item",
              ItemName = "item 2",
          });
      }
  }
  </code></pre>
  
  <p>thats what i have so far but it doesn't display anything?</p>
  
  <p>Thanks
  Houlahan</p>