Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7360b5f

Browse files
Youssef1313Ron Petrusha
authored andcommitted
Add missing visual basic sample (dotnet#2936)
* Add missing visual basic sample * Apply suggestions from code review Co-Authored-By: Ron Petrusha <[email protected]> * Update HttpClient.xml
1 parent 7bc1ba2 commit 7360b5f

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

xml/System.Net.Http/HttpClient.xml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Type Name="HttpClient" FullName="System.Net.Http.HttpClient">
1+
<Type Name="HttpClient" FullName="System.Net.Http.HttpClient">
22
<TypeSignature Language="C#" Value="public class HttpClient : System.Net.Http.HttpMessageInvoker" />
33
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit HttpClient extends System.Net.Http.HttpMessageInvoker" />
44
<TypeSignature Language="DocId" Value="T:System.Net.Http.HttpClient" />
@@ -61,16 +61,27 @@
6161
```csharp
6262
public class GoodController : ApiController
6363
{
64-
// OK
6564
private static readonly HttpClient HttpClient;
6665
6766
static GoodController()
6867
{
6968
HttpClient = new HttpClient();
7069
}
7170
}
72-
```
73-
71+
```
72+
73+
```vb
74+
Public Class GoodController
75+
Inherits ApiController
76+
77+
Private Shared ReadOnly HttpClient As HttpClient
78+
79+
Shared Sub New()
80+
HttpClient = New HttpClient()
81+
End Sub
82+
End Class
83+
```
84+
7485
The <xref:System.Net.Http.HttpClient> is a high-level API that wraps the lower-level functionality available on each platform where it runs.
7586
7687
On each platform, <xref:System.Net.Http.HttpClient> tries to use the best available transport:
@@ -127,7 +138,8 @@ If this change is undesirable, you can configure your application to use the old
127138
128139
## Examples
129140
[!code-csharp[System.Net.Http.HttpClient#1](~/samples/snippets/csharp/VS_Snippets_Misc/system.net.http.httpclient/cs/source.cs#1)]
130-
141+
[!code-vb[System.Net.Http.HttpClient#1](~/samples/snippets/visualbasic/VS_Snippets_Misc/system.net.http.httpclient/vb/source.vb#1)]
142+
131143
The preceding code example uses an `async Task Main()` entry point. That feature requires C# 7.1 or later.
132144
133145
]]></format>
@@ -157,17 +169,27 @@ If this change is undesirable, you can configure your application to use the old
157169
```csharp
158170
public class GoodController : ApiController
159171
{
160-
// OK
161172
private static readonly HttpClient HttpClient;
162173
163174
static GoodController()
164175
{
165176
HttpClient = new HttpClient();
166177
}
167178
}
168-
169-
```
170-
179+
```
180+
181+
```vb
182+
Public Class GoodController
183+
Inherits ApiController
184+
185+
Private Shared ReadOnly HttpClient As HttpClient
186+
187+
Shared Sub New()
188+
HttpClient = New HttpClient()
189+
End Sub
190+
End Class
191+
```
192+
171193
]]></format>
172194
</remarks>
173195
</Docs>

0 commit comments

Comments
 (0)