I came across another peculiar scenario for J#.
We all believe that out
parameters would not have to be initlialized since they are expected to return a
value from the calling method. But then again we have to think how its
implemented in J#. Ironically J# doesnt have a good idea about out parameters
and guess it uses it as a ref

Here is a hello
world for IAsyncResult.
I was wondering - does this internally spawn its own
thread ? Need some info as to how to catch exceptions thrown from this
?
Any help would be
appreciated.
using System;
namespace IAsyncTest
{
class Program
{
public delegate void AsyncTask();
[STAThread]
static void Main(string[] args)
{
Task t = new Task();
AsyncTask asyncTask = new AsyncTask(t.DoTask);
IAsyncResult ar = asyncTask.BeginInvoke(new AsyncCallback(t.Done),null);
Console.ReadLine();
}
}
public class Task
{
public void DoTask()
{
Console.WriteLine("Start Sleep");
System.Threading.Thread.Sleep(10000);
Console.WriteLine("End Sleep");
}
/// <summary>
/// IAsyncCallback Method
/// </summary>
/// <param name="ar"></param>
public void Done(IAsyncResult ar)
{
Console.WriteLine("Done");
}
}
}