QcloudSharp 是腾讯云 API 的非官方 .Net 封装。提供 Nuget 包和 DynamicObject 用法。简化了 API 调用。
PM> Install-Package QcloudSharp
using QcloudSharp; using Newtonsoft.Json; dynamic client = new QcloudClient { SecretId = "Your_Secret_Id", SecretKey = "Your_Secret_Key", Endpoint = Constants.Endpoint.Trade, // Endpoint 可被作为 Dynamic Methods 的第一个参数 Region = Constants.Region.CAN, // Region 可被作为 Dynamic Methods 的第一个或第二个参数 }; var resultString = client.DescribeUserInfo(); // 预期返回值 {"code":0,"message": "","userInfo":{"name":"compName","isOwner":1,"mailStatus":1,"mail":"112233@qq.com","phone":"13811112222"}} dynamic result = JsonConvert.DeserializeObject(resultString); try { Console.WriteLine(result.Code); Console.WriteLine(result.userInfo.name); Console.WriteLine(result.notExist); } catch(Exception ex) { Console.WriteLine(ex.message); }