0
진행 상태를 아래에서 어떻게 반환합니까? IProgress 상태를 올바르게 사용하고 있습니까? 어딘가에 Progress.report() 함수가 있다고 가정했지만 거기에있는 것처럼 보이지 않습니다.진행 상태 반환
public static void Main()
{
Console.WriteLine("Running Async Methods");
AsynchronousMethods am = new AsynchronousMethods();
Progress<int> p = new Progress<int>();
Task ta = am.asyncMethods(p);
while (!ta.IsCompleted)
{
// report progress
// I would liek to return the Progress here. I am not sure how?
// there doesnt seem to be a P.result
}
ta.Wait();
}
public async Task asyncMethods(IProgress<int> pro)
{
await Task.Run(() =>
{
for (int i = 0; i < 1999; i++)
{
Console.WriteLine("I is {0}", i);
pro.Report(i * 2);
}
});
}
을 처리해야 ProgressChanged' – SimpleVar