【发布时间】:2015-08-19 13:22:10
【问题描述】:
所以我有这个函数,我在所有 if-else 中都有一个返回但仍然得到编译错误:
并非所有代码路径都返回值
public async Task<bool> DeletePost(string update_id, string authId)
{
if (Utility.NetworkStatus.HasInternetAccess)
{
await APIs.DeletePost.DeletePostAPI(update_id, authId).ContinueWith((t) =>
{
if (t.Status == TaskStatus.RanToCompletion)
{
if (t.Result != null)
{
return t.Result.status == 200;
}
else
{
return false;
//empty result, API failed
//not implemented
}
}
else
{
return false;
//task failed
//not implemented
}
});
}
else
{
return false;
//no network
//not implemented
}
}
谁能告诉我我做错了什么?
【问题讨论】:
-
return await APIs.DeletePost.DeletePostAPI和return false在方法的末尾
标签: c# .net windows-runtime windows-phone-8.1 task