C#- Using AutoReset
csharp\nusing System.Threading;    \n\npublic class Foo \n{\n    private EventWaitHandle waitFirst;\n    private EventWaitHandle waitSecond;\n\n    public Foo()
```csharp\nusing System.Threading;    \n\npublic class Foo \n{\n    private EventWaitHandle waitFirst;\n    private EventWaitHandle waitSecond;\n\n    public Foo() \n    {\n        waitFirst = new AutoResetEvent(initialState: false);\n        waitSecond = new AutoResetEvent(initialState: false);\n    }\n\n    public void First(Action printFirst) \n    {   \n        // printFirst() outputs "first". Do not change or remove this line.\n        printFirst();\n        \n        waitFirst.Set();\n    }\n\n    public void Second(Action printSecond) \n    {\n        waitFirst.WaitOne();\n        \n        // printSecond() outputs "second". Do not change or remove this line.\n        printSecond();\n        \n        waitSecond.Set();\n    }\n\n    public void Third(Action printThird) \n    {\n        waitSecond.WaitOne();\n        \n        // printThird() outputs "third". Do not change or remove this line.\n        printThird();\n    }\n}\n```
[]