title: MVC.net get enum display name in view without having to refer to enum type in view
body: <p>I have the following helper method in a <code>ViewModelBase</code> class, which is inherited by other view Models:</p>
  
  <pre><code>public string GetEnumName&lt;T&gt;(Enum value)
          {
              Type enumType = typeof(T);
              var enumValue = Enum.GetName(enumType, value);
              MemberInfo member = enumType.GetMember(enumValue)[0];
  
              var attrs = member.GetCustomAttributes(typeof(DisplayAttribute), false);
              var outString = ((DisplayAttribute)attrs[0]).Name;
  
              if (((DisplayAttribute)attrs[0]).ResourceType != null)
              {
                  outString = ((DisplayAttribute)attrs[0]).GetName();
              }
  
              return outString;
          }
  </code></pre>
  
  <p>I then call this from the view like this:</p>
  
  <pre><code>&lt;p&gt;
  @{var rel = Model.GetEnumDisplayName&lt;Enums.wheteverEnum&gt;(Model.wheteverEnum); }
  @rel
  &lt;/p&gt;
  </code></pre>
  
  <p>Question is - can I work this method so I don't have to tell it the type of the <code>enum</code>? Basically I'd like todo this for all <code>enum</code>s:</p>
  
  <p>
      @Model.GetEnumDisplayName(Model.wheteverEnum)
  </p>
  
  <p>No <code>typeof</code>, no <code>T</code>, no need to add a reference to the <code>Enums</code> namespace in the View...</p>
  
  <p>Possible?</p>