static void TemperatureSensorTask(object o) { Options options = (Options)o; using (TemperatureSensor fs = new TemperatureSensor(options.TempSensorURI)) { fs.Run(options.RunningTime); } }