本文整理汇总了C#中ApiClient.GetAsync方法的典型用法代码示例。如果您正苦于以下问题:C# ApiClient.GetAsync方法的具体用法?C# ApiClient.GetAsync怎么用?C# ApiClient.GetAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiClient
的用法示例。
在下文中一共展示了ApiClient.GetAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
static async void Get()
{
using (var client = new ApiClient())
{
var response = await client.GetAsync( );
response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsAsync<object>();
}
}
示例2: RefreshAsync
/// <summary>
/// Refreshes object data from server
/// </summary>
/// <param name="forceRefresh">if true will not set the If-Modified-Since header, and will force the client to refetch all data from server.</param>
public async Task RefreshAsync(ApiClient client, bool forceRefresh)
{
object response = await client.GetAsync(Path, this.GetType(), forceRefresh ? null : this);
if (response == this)
return;
PropertyInfo[] properties = GetType().GetProperties();
for (int i = 0; i < properties.Length; i++)
{
object[] attrs = properties[i].GetCustomAttributes(typeof(DataMemberAttribute), true);
if (attrs != null && attrs.Length != 0)
{
properties[i].SetValue(this, properties[i].GetValue(response, null), null);
}
}
}