Instead of
    SwitchParameter restart = new SwitchParameter();
Do
     var restart = new SwitchParameter();

I