List Info

Thread: UI Marshall - Virtual Methods




UI Marshall - Virtual Methods
user name
2006-06-07 14:11:53
A virtual relationship is a language construct; it has
nothing to do with
windows or forms and won't do any "automatic
marshaling" of data or
threads contexts.

BTW, using BeginInvoke() is preferred over Invoke() because
Invoke()
leaves you open for race conditions.

See Ian Griffiths comments on Begin/BeginInvoke at
http://msdn.microsoft.com/msdnmag/issues/03/02/Mul
tithreading/

On Wed, 7 Jun 2006 05:52:02 -0500, Vince P
<vincep1974COMCAST.NET> wrote:

>I managed to confuse myself.
>
>
>
>
>
>Will this type of relationship between base and derived
Windows Form class
>properly Marshall the running thread for the virtual
method call (provided
>that base.Method(X) is called first in any override) ?
>
>
>
>class Base
>
>{
>
>
>
>protected delegate void
FormatDepartedUsersDelegate(string userName);
>
>protected virtual void FormatArrivedUsers(string
userName)
>
>{
>
>  if (this.InvokeRequired) {
>
>    this.BeginInvoke(new
>FormatArrivedUsersDelegate(this.FormatArrivedUsers), new
object[]{userName
>});
>
>  }
>
>  else {
>
>    .
>
>  }
>
>}
>
>}
>
>
>
>
>
>class Derived : Base
>
>{
>
>
>
>protected override void FormatArrivedUsers(string
userName)
>
>{
>
>base.FormatArrivedUsers(userName);
>
>.
>
>}
>
>}

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )