What's the C# pattern to perform an action on a series of values?
<p>I have this code:</p>

<pre><code>if (PsionTeklogix.Keyboard.Keyboard.GetModifierKeyState(Key.Orange) == KeyState.Lock)
    PsionTeklogix.Keyboard.Keyboard.InjectKeyboardCommand(Function.Orange, 0, 0);

if (PsionTeklogix.Keyboard.Keyboard.GetModifierKeyState(Key.Blue) == KeyState.Lock)
    PsionTeklogix.Keyboard.Keyboard.InjectKeyboardCommand(Function.Blue, 0, 0);

if (PsionTeklogix.Keyboard.Keyboard.GetModifierKeyState(Key.Shift) == KeyState.Lock)
    PsionTeklogix.Keyboard.Keyboard.InjectKeyboardCommand(Function.Shift, 0, 0);

if (PsionTeklogix.Keyboard.Keyboard.GetModifierKeyState(Key.Control) == KeyState.Lock)
    PsionTeklogix.Keyboard.Keyboard.InjectKeyboardCommand(Function.Control, 0, 0);

...
</code></pre>

<p>and I want to refactor the code separating the key / function definition from the
actions. Key.xxx and Function.xxx aren't from the same type.</p>

<p>eg: in Python, I could simply do something like:</p>

<pre><code>keys = (
    ( Key.Orange, Function.Orange ),
    ( Key.Blue  , Function.Blue ),
    ( Key.Shift , Function.Shift ),
    ...
    )

psi_key = PsionTeklogix.Keyboard.Keyboard

for key, func in keys:
    if psi_key.GetModifierKeyState(key) == KeyState.Lock):
        psi_key.InjectKeyboardCommand(func, 0, 0)
</code></pre>

<p>What's "the right way" to do in C#?</p>
