From a3fcb683ab173203e3c29b271a5f337a163e7574 Mon Sep 17 00:00:00 2001 From: Youssef Victor <31348972+Youssef1313@users.noreply.github.com> Date: Tue, 6 Aug 2019 15:43:38 +0200 Subject: [PATCH 1/3] Add missing visual basic sample --- xml/System.Net.Http/HttpClient.xml | 38 ++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/xml/System.Net.Http/HttpClient.xml b/xml/System.Net.Http/HttpClient.xml index b88075d1fe8..148a488dbb0 100644 --- a/xml/System.Net.Http/HttpClient.xml +++ b/xml/System.Net.Http/HttpClient.xml @@ -1,4 +1,4 @@ - + @@ -69,8 +69,20 @@ public class GoodController : ApiController HttpClient = new HttpClient(); } } -``` - +``` + +```vb + Public Class GoodController + Inherits ApiController + ' OK + Private Shared ReadOnly HttpClient As HttpClient; + + Shared Sub New() + HttpClient = New HttpClient() + End sub +End Class +``` + The is a high-level API that wraps the lower-level functionality available on each platform where it runs. On each platform, tries to use the best available transport: @@ -127,7 +139,8 @@ If this change is undesirable, you can configure your application to use the old ## Examples [!code-csharp[System.Net.Http.HttpClient#1](~/samples/snippets/csharp/VS_Snippets_Misc/system.net.http.httpclient/cs/source.cs#1)] - + [!code-vb[System.Net.Http.HttpClient#1](~/samples/snippets/visualbasic/VS_Snippets_Misc/system.net.http.httpclient/vb/source.vb#1)] + The preceding code example uses an `async Task Main()` entry point. That feature requires C# 7.1 or later. ]]> @@ -165,9 +178,20 @@ public class GoodController : ApiController HttpClient = new HttpClient(); } } - -``` - +``` + +```vb + Public Class GoodController + Inherits ApiController + ' OK + Private Shared ReadOnly HttpClient As HttpClient; + + Shared Sub New() + HttpClient = New HttpClient() + End sub +End Class +``` + ]]> From 30c8a4557c77fdd8458c3f64504a6a853f49d0b1 Mon Sep 17 00:00:00 2001 From: Youssef Victor <31348972+Youssef1313@users.noreply.github.com> Date: Tue, 6 Aug 2019 18:48:17 +0200 Subject: [PATCH 2/3] Apply suggestions from code review Co-Authored-By: Ron Petrusha --- xml/System.Net.Http/HttpClient.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xml/System.Net.Http/HttpClient.xml b/xml/System.Net.Http/HttpClient.xml index 148a488dbb0..ce7f9155b5b 100644 --- a/xml/System.Net.Http/HttpClient.xml +++ b/xml/System.Net.Http/HttpClient.xml @@ -73,13 +73,13 @@ public class GoodController : ApiController ```vb Public Class GoodController - Inherits ApiController - ' OK - Private Shared ReadOnly HttpClient As HttpClient; + Inherits ApiController + + Private Shared ReadOnly HttpClient As HttpClient Shared Sub New() HttpClient = New HttpClient() - End sub + End Sub End Class ``` @@ -182,13 +182,13 @@ public class GoodController : ApiController ```vb Public Class GoodController - Inherits ApiController - ' OK - Private Shared ReadOnly HttpClient As HttpClient; + Inherits ApiController + + Private Shared ReadOnly HttpClient As HttpClient Shared Sub New() HttpClient = New HttpClient() - End sub + End Sub End Class ``` From 22cdfe6946cbf7dfe2c293ce38ca1f5aa1cddc90 Mon Sep 17 00:00:00 2001 From: Youssef Victor <31348972+Youssef1313@users.noreply.github.com> Date: Tue, 6 Aug 2019 21:19:49 +0200 Subject: [PATCH 3/3] Update HttpClient.xml --- xml/System.Net.Http/HttpClient.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/xml/System.Net.Http/HttpClient.xml b/xml/System.Net.Http/HttpClient.xml index ce7f9155b5b..8b6c1b67271 100644 --- a/xml/System.Net.Http/HttpClient.xml +++ b/xml/System.Net.Http/HttpClient.xml @@ -61,7 +61,6 @@ ```csharp public class GoodController : ApiController { - // OK private static readonly HttpClient HttpClient; static GoodController() @@ -170,7 +169,6 @@ If this change is undesirable, you can configure your application to use the old ```csharp public class GoodController : ApiController { - // OK private static readonly HttpClient HttpClient; static GoodController()