From 1071fc9ccc2714910c4be6ec928d736c657cf664 Mon Sep 17 00:00:00 2001 From: Angelo Belchior Date: Mon, 20 May 2024 19:26:00 -0300 Subject: [PATCH] Adding using statement "using" statement is necessary when create a HttpClient --- .../asynchronous-programming/snippets/access-web/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/asynchronous-programming/snippets/access-web/Program.cs b/docs/csharp/asynchronous-programming/snippets/access-web/Program.cs index 3cbdf78fc939b..fab59b6b5118e 100644 --- a/docs/csharp/asynchronous-programming/snippets/access-web/Program.cs +++ b/docs/csharp/asynchronous-programming/snippets/access-web/Program.cs @@ -11,7 +11,7 @@ class AccessWeb // public async Task GetUrlContentLengthAsync() { - var client = new HttpClient(); + using var client = new HttpClient(); Task getStringTask = client.GetStringAsync("https://learn.microsoft.com/dotnet");