Reporter | Greg Finzer (gfinzer) |
---|---|
Created | Apr 23, 2012 6:17:19 PM |
Updated | Apr 23, 2012 6:17:19 PM |
Priority | Normal |
Type | Bug |
Fix versions | No Fix versions |
State | Submitted |
Assignee | Unassigned |
Subsystem | No subsystem |
Affected versions | 6.1.1 |
Fixed in build | No Fixed in build |
I have a using in a view that is required and Resharper says it can be removed:
@using SafeAuto.Mma.Web;
Resharper indicates the method cannot be found and it is in that namespace:
@{
ViewBag.Title = "List of Media Items for the " + Common.GetEnumDescription(Model.MediaLocation);
Layout = "~/Views/Shared/_Layout.cshtml";
}
Here is the static method in the static class Common:
public static string GetEnumDescription(Enum value)
{
string result = string.Empty;
if (value != null)
{
FieldInfo fi = value.GetType().GetField(value.ToString());
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
result = (attributes.Length > 0) ? attributes[0].Description : value.ToString();
}
return result;
}
@using SafeAuto.Mma.Web;
Resharper indicates the method cannot be found and it is in that namespace:
@{
ViewBag.Title = "List of Media Items for the " + Common.GetEnumDescription(Model.MediaLocation);
Layout = "~/Views/Shared/_Layout.cshtml";
}
Here is the static method in the static class Common:
public static string GetEnumDescription(Enum value)
{
string result = string.Empty;
if (value != null)
{
FieldInfo fi = value.GetType().GetField(value.ToString());
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
result = (attributes.Length > 0) ? attributes[0].Description : value.ToString();
}
return result;
}