System.Net.Http.HttpMessageHandler.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( ) : void
return void
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

Same methods

HttpMessageHandler::Dispose ( bool disposing ) : void

Usage Example

Beispiel #1
0
 public AsyncClient(
     string auth,
     int timeout,
     ProductInfoHeaderValue userAgent,
     HttpMessageHandler httpMessageHandler = null
     )
 {
     _httpMessageHandler = httpMessageHandler ?? new HttpClientHandler();
     try
     {
         _httpClient = new HttpClient(_httpMessageHandler)
         {
             DefaultRequestHeaders =
             {
                 Authorization = new AuthenticationHeaderValue("Basic", auth),
                 Accept = {new MediaTypeWithQualityHeaderValue("application/json")},
                 UserAgent = {userAgent}
             },
             Timeout = TimeSpan.FromMilliseconds(timeout)
         };
     }
     catch
     {
         _httpClient?.Dispose();
         _httpMessageHandler.Dispose();
         throw;
     }
 }
All Usage Examples Of System.Net.Http.HttpMessageHandler::Dispose