c# - The type or namespace name 'DescriptionAttribute' could not be found Asp.Net 5 -
i have simple class
using system; using system.componentmodel; using system.reflection; namespace common { public static class extensionmethods { public static string description(this enum value) { fieldinfo fi = value.gettype().getfield(value.tostring()); descriptionattribute[] attributes = (descriptionattribute[])fi.getcustomattributes( typeof(descriptionattribute), false); if (attributes.length > 0) { return attributes[0].description; } return value.tostring(); } } }
but i'm getting compile error -
error cs0246 type or namespace name 'descriptionattribute' not found (are missing using directive or assembly reference?)
my project.json
{ "version": "1.0.0-*", "description": "common class library", "authors": [ "bryan" ], "tags": [ "" ], "projecturl": "", "licenseurl": "", "frameworks": { "net451": { }, "dotnet5.4": { "dependencies": { "microsoft.csharp": "4.0.1-beta-23516", "system.collections": "4.0.11-beta-23516", "system.linq": "4.0.1-beta-23516", "system.runtime": "4.0.21-beta-23516", "system.threading": "4.0.11-beta-23516" } } } }
i have tried many things adding dependencies , frameworkassemblies various versions of system.component , system not have worked.
Comments
Post a Comment