title: Passing a view model to helper class
body: <p>I would like to display a tag cloud in my test application using a helper class to create the html.</p>
  
  <p>I can use a for each loop in the partial view to visit each item in the model</p>
  
  <pre><code>Inherits="System.Web.Mvc.ViewUserControl &lt; IEnumerable &lt; MyTestproject.Models.TagCount &gt; &gt;
  
  foreach (var item in Model) {
  
  }
  </code></pre>
  
  <p>But when I try to pass the model to the Helper class and use a for each loop I receive the following error:</p>
  
  <pre><code>public static string DisplayCloud &lt; TagCount &gt;(TagCount objTags) {
  
  ..
         foreach (var item in objTags) {
  
         }
  }
  </code></pre>
  
  <p>foreach statement cannot operate on variables of type 'TagCount' because 'TagCount' does not contain a public definition for 'GetEnumerator'</p>
  
  <p>What is the difference or am I passing it incorrectly?</p>