public static string GetDescription(this VkCode vkCode) { var memberInfo = typeof(VkCode).GetMember(vkCode.ToString()); if (memberInfo.Length > 0) { var attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false); if (attrs.Length > 0) { //Pull out the description value return(((DescriptionAttribute)attrs[0]).Description); } } //If no description attr, return ToString return(vkCode.ToString()); }
public override string ToString() { return("LowLevelKeyboardHookStruct:\r\n{\r\nvkCode: [" + VkCode.ToString() + " (" + (char)VkCode + ")]\r\nscanCode: [" + ScanCode.ToString() + "]\r\nflags: [" + Flags.ToString() + "]\r\ntime: [" + Time.ToString() + "]\r\ndwExtraInfo: [" + DwExtraInfo.ToString() + "]\r\n}"); }