What is the difference between the following?
public delegate void SetSthDelegate(int[] x);
// 1)
SetSthDelegate sst = new SetSthDelegate(SetSthMethod);
sst(x);
// 2)
Invoke(new SetSthDelegate(SetSthMethod), new object[] {x}
// 3)
BeginInvoke(new SetSthDelegate(SetSthMethod), new object[] {x}
I learned that 2) is for invoking methods synchronously while 3) is for invoking methods asynchronously, but when do you want to invoke methods synchronously and asynchronously?
Can someone show me when an illustration and explanation when to use 1), 2), 3) is more appropriate.
Edit: Can also explain why ppl prefers Invoke over BeingInvoke and visa versa?