This is an Easy Q, but great help:
Under title" Retrieving data from threads MSDN (Here) introduces a way to get data from a child thread by using callback method which is encapsulated by a delegate passed from main thread to the child thread - who has the data.
You can see that clearly ( the last Example in the MSDN page)
My Q is, since we are taking about retrieving data (from child threads to main thread) the call back method should be executed by the main thread and not by the child thread...
I changed the code a bit ( to verify that) so I attached the name of the thread before each output:
public static void ResultCallback(int lineCount) {
Console.WriteLine(Thread.CurrentThread.Name + ":Independent task printed {0} lines.", lineCount);
}
And I named the child thread: "Method2" while the main thread "System"...
I got this output: Method2: Independent task printed 1 lines.
where the correct output should have been : System:Independent task printed 1 lines..
Who is drunk here? MSDN, me or .NET?