Results 1 to 4 of 4

Thread: BeginInvoke and Invoke

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    BeginInvoke and Invoke

    Microsoft have done it again. I simply want to find documentation about invoke and begininvoke. A member of delegates.

    Guess what, simply searching on it on bing and stuff don't show anything. It shows control.invoke, etc.

    In the delegate msdn entry there is no invoke member. At least not when I look for system.action or system.func.

    Where can I found begininvoke documentation? what will happen if I put nothing as callback function for example? Intuitively the program simply don't call any call back function but hei, I want to makes ure of it.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: BeginInvoke and Invoke

    The reason that there is no documentation for those methods is that they don't exist as part of the .NET Framework. They are emitted dynamically by the compiler. I didn't know this myself but it took me about 5 minutes of searching on MSDN to find out. After a few failed searches and the use of F1 in the IDE, I searched MSDN online for delegate begininvoke. This was the first result:

    http://msdn.microsoft.com/en-us/libr...8VS.71%29.aspx

    After clicking a few links I was here:

    http://msdn.microsoft.com/en-us/library/22t547yb.aspx

    That doesn't answer your question explicitly but it does do so implicitly:
    If a callback method has been specified in the call to the BeginInvoke method, the callback method is called when the target method ends.
    That implies that it is quite legal to not specify a callback method.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: BeginInvoke and Invoke

    I see. I also realized that unlike the regular usage of system.threading.thread, there is no way you do not want to specify the callback method. There is no other way to know whether the thread has ended or not.

    If w

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: BeginInvoke and Invoke

    There certainly is reason not to specify a callback method. Sometimes you need to do something when the asynchronous operation completes and sometimes you don't. If you do then you need a callback to do it. If you don't then you don't need a callback.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width