/// <summary> /// Sends a PUT request as an asynchronous operation to the specified Uri with <paramref name="value"/> /// serialized using the given <paramref name="formatter"/>. /// </summary> /// <typeparam name="T">The type of <paramref name="value"/>.</typeparam> /// <param name="client">The client used to make the request.</param> /// <param name="requestUri">The Uri the request is sent to.</param> /// <param name="value">The value that will be placed in the request's entity body.</param> /// <param name="formatter">The formatter used to serialize the <paramref name="value"/>.</param> /// <param name="mediaType">The authoritative value of the request's content's Content-Type header. Can be <c>null</c> in which case the /// <paramref name="formatter">formatter's</paramref> default content type will be used.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A task object representing the asynchronous operation.</returns> public static Task <HttpResponseMessage> PutAsync <T>(this HttpClient client, Uri requestUri, T value, MediaTypeFormatter formatter, string mediaType, CancellationToken cancellationToken) { return(client.PutAsync(requestUri, value, formatter, ObjectContent.BuildHeaderValue(mediaType), cancellationToken)); }