Пример #1
0
    private Knob Knob(string letter, int index = 0)
    {
        Knob found = null;
        int  count = 0;

        knobs.ForEach(knob => {
            if (knob.Text() == letter)
            {
                if (count == index)
                {
                    found = knob;
                }
                count++;
            }
        });
        if (found == null)
        {
            throw new InvalidOperationException("not a named knob: " + letter);
        }
        return(found);
    }
Пример #2
0
 private void ReleaseAllKnobs()
 {
     knobs.ForEach(knob => { Leave(knob); });
 }