Use Dictionary<TKey, TValue> :
Level class:
private readonly Dictionary<string, string> operations = new Dictionary<string, string>; public ClassName() {
In your method, just use operations[e.Key.ToString()] .
Edit: Actually, for greater efficiency:
private readonly Dictionary<System.Windows.Input.Key, char> operations = new Dictionary<System.Windows.Input.Key, char>; public ClassName() {
In your method, just use operations[e.Key] .
source share