public static string HotKey2Str(Key key, ModifierKeys modifier) { if (!Enum.IsDefined(typeof(Key), key)) { throw new InvalidEnumArgumentException(nameof(key), (int)key, typeof(Key)); } try { ModifierKeysConverter mkc = new ModifierKeysConverter(); var keyStr = Enum.GetName(typeof(Key), key); var modifierStr = mkc.ConvertToInvariantString(modifier); return($"{modifierStr}+{keyStr}"); } catch (NotSupportedException) { return(null); } }