Could someone please explain the difference of (refer to example code below)
d.BeginInvoke("some text", null,null); //Alternative A
and
BeginInvoke( d, new object[] { "some text" } //Alternative B
Both calls causes asynchonous execution to begin at the address specified by
the delegate, and both calls returns an IAsyncResult, isn't that so?
However I've experienced that these calls can cause different program
behaviour.
Someone please explain.
**********Example code:******************
public delegate void SomeDelegate(string s);
private void SomeDelegateMethod(string s)
{
//Do whatever with the string
}
private void SomeOtherMethod()
{
SomeDelegate d = new SomeDelegate(SomeDelegateMethod);
//Alternative A:
d.BeginInvoke("some text", null,null);
//Alternative B:
BeginInvoke( d, new object[] { "some text" }
}
************************************