title: How to break big foreach loop into batch and process it simultaneously?
body: <pre><code>foreach (var deviceId in deviceList)
  {
      // register device into IoT hub 
      Device device;
      RegistryManager registryManager = RegistryManager.CreateFromConnectionString("connectionString");
      device = await registryManager.AddDeviceAsync(new Device(deviceId));
  
      // send message to iot hub
      DeviceClient deviceClient;
      await deviceClient.SendEventAsync("data");                       
  }
  </code></pre>
  
  <p>if device are 10000 then how can i break it into multiple batch and process it?</p>
  
  <p>I tried this code but its not promissing</p>
  
  <pre><code>public IEnumerable&lt;user&gt; GetBatch(int pageNumber)
  {
      return users.Skip(pageNumber * 1000).Take(1000);
  }
  </code></pre>