title: Integer extension in mvc razor view
body: <p>I am all new with ASP.NET MVC and Extension methods.</p>
  
  <p>I have created two Extensions that i want to use in my View:</p>
  
  <pre><code>public static class Extensions
  {
      public static string ToYesNo(this bool value)
      {
          return value ? "Yes" : "No";
      }
  
      public static string MonthToString(this int value)
      {
          return (value &gt;= 1 &amp;&amp; value &lt;= 12) ? CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(value) : "";
      }
  }
  </code></pre>
  
  <p>I can use ToYesNo with a bool in the View, but i cannot view MonthToString with an integer. I get:</p>
  
  <pre><code>'int' does not contain a definition for 'MonthToString'
  </code></pre>
  
  <p>The Extensions are in a namespace called BitvaerkAdmin.Models, and i reference that in th cshtml file.</p>
  
  <p>Why can't i use my integer extension?</p>
  
  <p>Edit:</p>
  
  <p>I reference the extensions in my view like this:</p>
  
  <pre><code>@using BitvaerkAdmin.Models
  
  
  &lt;h3&gt;
      @ViewBag.Month.MonthToString()
  &lt;/h3&gt;
  
  
  
  @foreach (Order order in ViewBag.Orders)
  {
      &lt;td&gt;
      @order.Valid.ToYesNo()
      &lt;/td&gt;
  }
  </code></pre>