i find the solution
i create a extension method so i can call in this way:
for example:
string E012345= "generic error";
string nameVar = E012345.getName();
public static class Ext
{
public static string GetNumber(this string errorString)
{
var yyy = typeof(ErrorBase).GetProperties();
foreach (var s in yyy)
{
PropertyInfo p = typeof(ErrorBase).GetProperty(s.Name);
var m = p.GetValue(s);
if (m != null)
if (p.GetValue(s).ToString().CompareTo(errorString) == 0)
{
return s.Name.Substring(1).ToString();
}
}
return "";
}
}
so return s.Name.Substring(1).ToString(); give me 012345
and return s.Name.ToString(); give me E012345