이 방법이 있습니다.
async Task<int> AccessTheWebAsync()
{
HttpClient client = new HttpClient();
Task<string> getStringTask = client.GetStringAsync("http://msdn.microsoft.com");
// You can do work here that doesn't rely on the string from GetStringAsync.
DoIndependentWork();
string urlContents = await getStringTask;
//The thing is that this returns an int to a method that has a return type of Task<int>
return urlContents.Length;
}
Task<int>
와 사이에 암시 적 변환이 발생 int
합니까? 그렇지 않다면 무슨 일이 일어나고 있습니까? 작동하려면 어떻게 구현됩니까?
async
키워드 를 기반으로 처리한다고 가정합니다 .