D
Dom
I'm teaching myself about delegates and the Invoke method, and I have
a few newbie questions for the gurus out there:
Here are some CSharp statements:
1. public delegate void MyDelegate (int k, string s)
2. MyDelegate MyDelegateVar = MyMethod
3. MyForm.Invoke (MyDelegateVar)
Some questions:
1. What is the meaning of "public" in the first statement? The help
examples always use that. Isn't "private" more appropriate?
2. What is the purpose of "k" and "s" in the parameter list?
3. Isn't this a needless complication over C's pointer to a function,
which did in one statement what is done in two statements above? It
doesn't seem to be any more type-safe than what we had in C.
3. MyForm.Left has a different meaning that MyButton.Left, but what
is the difference between MyForm.Invoke, and MyButton.Invoke? For
that matter, why do we not just have System.Invoke, or something like
that?
Thanks,
Dom
a few newbie questions for the gurus out there:
Here are some CSharp statements:
1. public delegate void MyDelegate (int k, string s)
2. MyDelegate MyDelegateVar = MyMethod
3. MyForm.Invoke (MyDelegateVar)
Some questions:
1. What is the meaning of "public" in the first statement? The help
examples always use that. Isn't "private" more appropriate?
2. What is the purpose of "k" and "s" in the parameter list?
3. Isn't this a needless complication over C's pointer to a function,
which did in one statement what is done in two statements above? It
doesn't seem to be any more type-safe than what we had in C.
3. MyForm.Left has a different meaning that MyButton.Left, but what
is the difference between MyForm.Invoke, and MyButton.Invoke? For
that matter, why do we not just have System.Invoke, or something like
that?
Thanks,
Dom