Question: I have the following helper method in a `ViewModelBase` class, which is inherited by other view Models:

```
public string GetEnumName<T>(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;
        }

```

I then call this from the view like this:

```
<p>
@{var rel = Model.GetEnumDisplayName<Enums.wheteverEnum>(Model.wheteverEnum); }
@rel
</p>

```

Question is - can I work this method so I don't have to tell it the type of the `enum`? Basically I'd like todo this for all `enum`s:

 @Model.GetEnumDisplayName(Model.wheteverEnum)

No `typeof`, no `T`, no need to add a reference to the `Enums` namespace in the View...

Possible?

Answer: 
Nice work @jrummell!

I've added a small tweak below which captures the scenario where an enum doesn't have an associated **Display** attribute (currently it throws an exception)

```
/// <summary>
/// Gets the DataAnnotation DisplayName attribute for a given enum (for displaying enums values nicely to users)
/// </summary>
/// <param name="value">Enum value to get display for</param>
/// <returns>Pretty version of enum (if there is one)</returns>
/// <remarks>
/// Inspired by :
///     http://stackoverflow.com/questions/9328972/mvc-net-get-enum-display-name-in-view-without-having-to-refer-to-enum-type-in-vi
/// </remarks>
public static string DisplayFor(this Enum value) {
    Type enumType = value.GetType();
    var enumValue = Enum.GetName(enumType, value);
    MemberInfo member = enumType.GetMember(enumValue)[0];
    string outString = "";

    var attrs = member.GetCustomAttributes(typeof(DisplayAttribute), false);
    if (attrs.Any()) {
        var displayAttr = ((DisplayAttribute)attrs[0]);

        outString = displayAttr.Name;

        if (displayAttr.ResourceType != null) {
            outString = displayAttr.GetName();
        }
    } else {
        outString = value.ToString();
    }

    return outString;
}

```
The answer of @jrummell in VB.NET for the few of us...

```
Module ModuleExtension

    <Extension()>
    Public Function DisplayName(ByVal value As System.Enum) As String

        Dim enumType As Type = value.GetType()
        Dim enumValue = System.Enum.GetName(enumType, value)
        Dim member As MemberInfo = enumType.GetMember(enumValue)(0)

        Dim attrs = member.GetCustomAttributes(GetType(DisplayAttribute), False)
        Dim outString = CType(attrs(0), DisplayAttribute).Name

        If (CType(attrs(0), DisplayAttribute).ResourceType IsNot Nothing) Then
            outString = CType(attrs(0), DisplayAttribute).GetName()
        End If

        Return outString
    End Function

End Module

```