Can I do this using using var
:
await foreach (var response in _container.GetItemQueryStreamIterator(query))
{
using var safeResponse = response;
//use the safeResponse
}
or should I do this:
await foreach (var response in _container.GetItemQueryStreamIterator(query))
{
try {
//use response
} finally {
response?.Dispose();
}
}
or can I just go without disposing because the iterator is an IAsyncDisposable
and the await foreach
will do it for me?
await foreach (var response in _container.GetItemQueryStreamIterator(query))
{
//use the response
}