映画に関する情報を取得するために API を使用しようとしています。実際に動作するこのAPI を使用しています。
唯一のことは、それが遅くなる方法であり、それを行うためのより速い方法があるかどうか疑問に思いましたか? これは私にとってかなり新しいことだと言わざるを得ません。ここにいくつかのコードがあります。
public string Connect()
{
WebRequest request = WebRequest.Create(this.url);
request.ContentType = "application/json; charset=utf-8";
//this is slowing me down
WebResponse response = (HttpWebResponse)request.GetResponse();
using (StreamReader sr = new StreamReader(response.GetResponseStream()))
{
jsonString = sr.ReadToEnd();
}
return jsonString;
}
public static string GetFilmInfo(string titel)
{
MakeCon checkVat = new MakeCon("http://www.imdbapi.com/?i=&t=red" + titel + "/");
JsonSerializer serializer = new JsonSerializer();
string jsonString = checkVat.Connect();
return JsonConvert.DeserializeObject<string>(jsonString);
}