//==============================================================
// ツイートリクエスト
//==============================================================
HttpClient Client = new HttpClient() { BaseAddress = new UriBuilder( "https://api.x.com" ).Uri, };
//--------------------------------------------------------------
// HTTPヘッダー
//--------------------------------------------------------------
Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue( "Bearer", "$(アクセストークン: コールバック後に取得したもの)" );
Client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue( "application/json" ) );
Client.DefaultRequestHeaders.UserAgent.Add( new ProductInfoHeaderValue( new ProductHeaderValue( "$(PN)" ) ) ); /* 必須ではない */
//--------------------------------------------------------------
// HTTPコンテンツ
//--------------------------------------------------------------
var QueryDict = new Dictionary<string, string>() { { "text", "Hello World!" }, };
JsonContent HttpBody = JsonContent.Create( QueryDict, new MediaTypeHeaderValue( MediaTypeNames.Application.Json ) );
//--------------------------------------------------------------
// HTTPリクエスト
//--------------------------------------------------------------
using( HttpResponseMessage Response = await Client.PostAsync( "/2/tweets", HttpBody ).ConfigureAwait( true ) )
{
/* Responseの戻り値でHTTPステータスが200番台なら成功 */
}