5.5同步与异步方法

创建于 2026 年 8 月 17 日约 1 分钟读完

IHttpService 的声明式请求接口方法定义中,我们既提供了异步方法的实现,也支持同步方法的定义。例如:

cs
public interface IHttpService : IHttpDeclarative{    // 异步请求方法    [Get("https://furion.net/")]    Task<string> GetMethodAsync();    // 同步请求方法    [Get("https://furion.net/")]    string GetMethod();}