public Task StartAsync(CancellationToken cancellationToken) { Console.WriteLine("Beginning device simulation.."); _sendData = true; for (int i = 0; i < _connectionStrings.DeviceConnections.Length; i++) { Console.WriteLine($"Preparing client {i + 1}/{_connectionStrings.DeviceConnections.Length}"); var instance = new DeviceInstance(_connectionStrings.DeviceConnections[i]); _backgroundWorkers.Add(SimulateAsync(instance)); } return(Task.CompletedTask); }