c# 使用HttpClient的post,get方法传输json
微软文档地址https://docs.microsoft.com/zh-cn/dotnet/api/system.net.http.httpclient?view=netframework-4.7.2,只有get。post 的方法找了白天才解决 using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MySql.Data.MySqlClient; using System.Timers; using Newtonsoft.Json; using System.Net.Http; using System.IO; using System.Net; public class user { public string password;//密码hash public string account;//账户 } static async void TaskAsync() { using (var client = new HttpClient()) { try { //序列化 user user = new user(); user.account = "zanllp"; user.password = "zanllp_pw";