Opc.Ua.Com.ComUtils.GetErrorText C# (CSharp) Method

GetErrorText() public static method

Returns the symbolic name for the specified error.
public static GetErrorText ( Type type, int error ) : string
type System.Type
error int
return string
        public static string GetErrorText(Type type, int error)
        {                       
			FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Static);
            
			foreach (FieldInfo field in fields)
			{
                if (error == (int)field.GetValue(type))
				{
					return field.Name;
				}
			}

		    return String.Format("0x{0:X8}", error);
        }