Re: Update UI from another thread; unnecessary code?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Duniho

    Re: Update UI from another thread; unnecessary code?

    On Tue, 14 Oct 2008 10:01:25 -0700, robert.waters
    <robert.waters@ gmail.comwrote:
    [...]
    It worked! Thanks!
    Perhaps using an anonymous method bypasses the 'take no parameters'
    restriction?
    That depends on your definition of "bypasses". Using the anoymous method
    doesn't remove the restriction; the anonymous method signature _does_ in
    fact wind up taking no parameters.

    But with an anonymous method, you can "capture" any variable accessible in
    the method in which the anonymous method is declared. So rather than
    passing the string to the delegate method, the "e" method argument winds
    up captured and used within the anonymous method directly.

    In that respect, the anonymous method does bypass the restriction, by
    allowing you to get data into the anonymous method without passing it.

    Pete
  • robert.waters

    #2
    Re: Update UI from another thread; unnecessary code?

    On Oct 14, 1:23 pm, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
    wrote:
    On Tue, 14 Oct 2008 10:01:25 -0700, robert.waters  
    >
    <robert.wat...@ gmail.comwrote:
    [...]
    It worked! Thanks!
    Perhaps using an anonymous method bypasses the 'take no parameters'
    restriction?
    >
    That depends on your definition of "bypasses".  Using the anoymous method  
    doesn't remove the restriction; the anonymous method signature _does_ in  
    fact wind up taking no parameters.
    >
    But with an anonymous method, you can "capture" any variable accessible in  
    the method in which the anonymous method is declared.  So rather than  
    passing the string to the delegate method, the "e" method argument winds  
    up captured and used within the anonymous method directly.
    >
    In that respect, the anonymous method does bypass the restriction, by  
    allowing you to get data into the anonymous method without passing it.
    >
    Pete
    So rather than
    passing the string to the delegate method, the "e" method argument winds
    up captured and used within the anonymous method directly.
    Thank you for the explanation.

    Comment

    Working...