Skip to content

Instantly share code, notes, and snippets.

@Ershad95

Ershad95/apis.cs Secret

Created January 28, 2023 04:59
Show Gist options
  • Save Ershad95/1e42d259ed1461088dcb91f4424e54a6 to your computer and use it in GitHub Desktop.
Save Ershad95/1e42d259ed1461088dcb91f4424e54a6 to your computer and use it in GitHub Desktop.
[HttpGet]
public async IAsyncEnumerable<Customer> Get()
{
while (_customers.Any(_ => _.Key % 10 == 0))
{
var customer = _customers.First(_ => _.Key % 10 == 0);
yield return new Customer(customer.Value.Name, customer.Key);
_customers.Remove(customer);
await Task.Delay(500);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment