Why my async call does not work?
Posted
by Petr
on Stack Overflow
See other posts from Stack Overflow
or by Petr
Published on 2010-04-30T07:25:32Z
Indexed on
2010/04/30
7:37 UTC
Read the original article
Hit count: 279
Hi, I am trying to understand what is IAsyncresult good and therefore I wrote this code. The problem is it behaves as I called "MetodaAsync" normal way. While debugging, the program stops here until the method completed. Any help appreciated, thank you.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ConsoleApplication1
{
class Program
{
delegate int Delegat();
static void Main(string[] args)
{
Program p=new Program();
Delegat d = new Delegat(p.MetodaAsync);
IAsyncResult a = d.BeginInvoke(null, null); //I have removed callback
int returned=d.EndInvoke(a);
Console.WriteLine("AAA");
}
private int MetodaAsync()
{
int AC=0;
for (int I = 0; I < 600000; I++)
{
for (int A = 0; A < 6000000; A++)
{
}
Console.Write("B");
}
return AC;
}
}
}
© Stack Overflow or respective owner