0
我想运行一个C#控制台程序:的方法的类型参数“HttpRequest.asJson()”不能推断
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Task<HttpResponse<MyClass>> response = Unirest.get("https://wordsapiv1.p.mashape.com/words/cat/rhymes")
.header("X-Mashape-Key", "xxx")
.header("Accept", "application/json")
.asJson();
}
}
internal class MyClass
{
public string word { get; set; }
}
}
但是,这是给我下面的错误:
Error CS0411 The type arguments for method 'HttpRequest.asJson()' cannot be inferred from the usage. Try specifying the type arguments explicitly.
有没有人有任何想法,我可能做错了什么?
请注意,如果你使用'词典<字符串,对象>',这可能是最接近无类型,你可以在这种情况下,走了。 – Jacob