fundamental scope question

J

Jon Skeet [C# MVP]

Peter Duniho said:
Yet another "Control.Invoke vs Delegate.Invoke" issue?
:)

There *is* a doc page for Control.EndInvoke(). I naively have assumed
that the same concepts apply to both, and that since you can call
EndInvoke on a delegate and get "ref" and "out" parameters, you can do the
same with Control instances.

But now that you point out the lack of a Delegate.EndInvoke() doc page, I
note that Control.EndInvoke() is a specific method attached to the Control
class, rather than being auto-generated according to the delegate being
used (just as Control.Invoke() or Control.BeginInvoke() is a specific
method, and requires passing of parameters as an array in a single
parameter, rather than using the signature provided for by the delegate
being invoked).

Exactly. It can't be auto-generated according to the delegate being
used, because the Control class doesn't know what kind of delegate you
might have defined.

Nonetheless, just because EndInvoke() is different for each delegate,
according to its signature, I don't see why there should not be a doc page
for it. After all, I got to the page that describes the
Delegate.EndInvoke() syntax from the Control.EndInvoke() doc page.
Obviously there's some room for less-concrete contexts for documentation.

There can certainly be documentation *about* it, just not the normal
sort of "Here's a method and its signature, and what it does"
autogenerated from XML comments.

There'd certainly be nothing to stop the Delegate type "about" page
having a link to a page about asynchronous execution (and I guess it
probably does).
True. And as I think I've mentioned previously, I think that's a good
thing. I can't imagine many, if any, scenarios in which passing "ref" or
"out" to an asynchronously-invoked delegate could be shown to be good
design.

Indeed. Heck, I try to avoid ref/out in synchronous calls, let alone
asynchronous :)
Still, one of my biggest complaints about programming has always
been, and continues to be, the poor documentation. I think MSDN has made
great strides beyond what I used to have to deal with, but there are still
places it could be *lots* better.

Indeed. And it's been flat out wrong and misleading in plenty of
places. (For a long time it claimed that decimal was a fixed point
type, which was my personal bugbear.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top