From a6b06e345f14db6f7079bea1c997372fbda2ed81 Mon Sep 17 00:00:00 2001 From: SaurabhSharma-MSFT <38112130+SaurabhSharma-MSFT@users.noreply.github.com> Date: Wed, 16 Feb 2022 09:49:48 -0800 Subject: [PATCH] Documentation: Fixes ReadManyItemsStreamAsync example (#3034) Updated ReadManyItemsStreamAsync example code snippet with proper working code. --- .../src/Resource/Container/Container.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs b/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs index 0c470700f2..c1f0dda873 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs @@ -639,16 +639,20 @@ public abstract Task> ReplaceItemAsync( /// ("Id3", new PartitionKey("pkValue3")) /// }; /// - /// using (ResponseMessage responseMessage = await this.Container.ReadManyItemsStreamAsync(itemList)) + /// using (ResponseMessage response = await this.Container.ReadManyItemsStreamAsync(itemList)) /// { - /// using (Stream stream = response.ReadBodyAsync()) + /// if (!response.IsSuccessStatusCode) /// { - /// //Read or do other operations with the stream - /// using (StreamReader streamReader = new StreamReader(stream)) - /// { - /// string content = streamReader.ReadToEndAsync(); - /// } + /// //Handle and log exception + /// return; /// } + /// + /// //Read or do other operations with the stream + /// using (StreamReader streamReader = new StreamReader(response.Content)) + /// { + /// string content = streamReader.ReadToEndAsync(); + /// } + /// /// } /// ]]> ///