Skip to content

Commit 4501564

Browse files
committed
Update MarkdownTextBlockImageProviderSample.xaml.cs
1 parent a2bfa7e commit 4501564

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

components/MarkdownTextBlock/samples/MarkdownTextBlockImageProviderSample.xaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ private void UpdateResults()
179179
/// </summary>
180180
private class TestImageProvider : IImageProvider
181181
{
182+
private static readonly System.Net.Http.HttpClient s_httpClient = new();
183+
182184
private readonly double _width;
183185
private readonly double _height;
184186
private readonly string _realImageUrl;
@@ -202,8 +204,7 @@ public async Task<Image> GetImage(string url)
202204
// Load a real image so it's visible
203205
try
204206
{
205-
var httpClient = new System.Net.Http.HttpClient();
206-
var data = await httpClient.GetByteArrayAsync(_realImageUrl);
207+
var data = await s_httpClient.GetByteArrayAsync(_realImageUrl);
207208
var bitmap = new BitmapImage();
208209
using (var stream = new InMemoryRandomAccessStream())
209210
{

0 commit comments

Comments
 (0)