System.Net.Http.HttpClient.DeleteAsync C# (CSharp) Méthode

DeleteAsync() public méthode

public DeleteAsync ( string requestUri ) : Task
requestUri string
Résultat Task
        public Task<HttpResponseMessage> DeleteAsync(string requestUri)
        {
            return DeleteAsync(CreateUri(requestUri));
        }

Same methods

HttpClient::DeleteAsync ( Uri requestUri ) : Task
HttpClient::DeleteAsync ( Uri requestUri, CancellationToken cancellationToken ) : Task
HttpClient::DeleteAsync ( string requestUri, CancellationToken cancellationToken ) : Task

Usage Example

 public async Task<Result> DeleteData(Uri uri, StringContent json, UserAuthenticationEntity userAuthenticationEntity, string language = "ja")
 {
     using (var httpClient = new HttpClient())
     {
         try
         {
             var authenticationManager = new AuthenticationManager();
             Result result = new Result(false, "");
             if (RefreshTime(userAuthenticationEntity.ExpiresInDate))
             {
                 var tokens = await authenticationManager.RefreshAccessToken(userAuthenticationEntity.RefreshToken);
                 result.Tokens = tokens.Tokens;
             }
             httpClient.DefaultRequestHeaders.Add("Accept-Language", language);
             httpClient.DefaultRequestHeaders.Add("Origin", "http://psapp.dl.playstation.net");
             httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", userAuthenticationEntity.AccessToken);
             var response = await httpClient.DeleteAsync(uri);
             var responseContent = await response.Content.ReadAsStringAsync();
             result.IsSuccess = response.IsSuccessStatusCode;
             result.ResultJson = responseContent;
             return result;
         }
         catch (Exception)
         {
             return new Result(false, string.Empty);
         }
     }
 }
All Usage Examples Of System.Net.Http.HttpClient::DeleteAsync