|
1 | | -<Type Name="HttpClient" FullName="System.Net.Http.HttpClient"> |
| 1 | +<Type Name="HttpClient" FullName="System.Net.Http.HttpClient"> |
2 | 2 | <TypeSignature Language="C#" Value="public class HttpClient : System.Net.Http.HttpMessageInvoker" /> |
3 | 3 | <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit HttpClient extends System.Net.Http.HttpMessageInvoker" /> |
4 | 4 | <TypeSignature Language="DocId" Value="T:System.Net.Http.HttpClient" /> |
|
61 | 61 | ```csharp |
62 | 62 | public class GoodController : ApiController |
63 | 63 | { |
64 | | - // OK |
65 | 64 | private static readonly HttpClient HttpClient; |
66 | 65 |
|
67 | 66 | static GoodController() |
68 | 67 | { |
69 | 68 | HttpClient = new HttpClient(); |
70 | 69 | } |
71 | 70 | } |
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 | +
|
74 | 85 | The <xref:System.Net.Http.HttpClient> is a high-level API that wraps the lower-level functionality available on each platform where it runs. |
75 | 86 |
|
76 | 87 | 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 |
127 | 138 |
|
128 | 139 | ## Examples |
129 | 140 | [!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 | +
|
131 | 143 | The preceding code example uses an `async Task Main()` entry point. That feature requires C# 7.1 or later. |
132 | 144 | |
133 | 145 | ]]></format> |
@@ -157,17 +169,27 @@ If this change is undesirable, you can configure your application to use the old |
157 | 169 | ```csharp |
158 | 170 | public class GoodController : ApiController |
159 | 171 | { |
160 | | - // OK |
161 | 172 | private static readonly HttpClient HttpClient; |
162 | 173 | |
163 | 174 | static GoodController() |
164 | 175 | { |
165 | 176 | HttpClient = new HttpClient(); |
166 | 177 | } |
167 | 178 | } |
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 | +
|
171 | 193 | ]]></format> |
172 | 194 | </remarks> |
173 | 195 | </Docs> |
|
0 commit comments