[Gtk-sharp-list] Gtk.Application.Invoke + anonymous delegates == lots of uints?
monoman at gmail.com
Sat Dec 9 16:33:04 EST 2006
Thanks Jon for clarifying this.
On 12/9/06, Jonathan Pryor <jonpryor at vt.edu> wrote:
> On Sat, 2006-12-09 at 11:36 -0200, Rafael Teixeira wrote:
> > I checked the code and discovered that Convert.ToString (int) also
> > autoboxes the int parameter and calls the ToString override of int32.
> You seem to believe that calling .ToString() on a struct requires boxing
> the struct. This is incorrect -- the struct is only boxed if ToString()
> isn't overridden, and it *is* overridden on the built-in types.
> In other words, this shouldn't cause any boxing:
> uint n = (uint) 42;
> string s = n.ToString ();
> It's only the assignment of a value-type to System.Object or an
> interface that it must be boxed. Direct method invocation doesn't
> require boxing (unless the method being invoked isn't directly
> implemented on the structure, in which case it needs to be boxed in
> order to call the base class version -- examples being GetHashCode(),
> Equals(), and ToString()).
> - Jon
> Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
Rafael "Monoman" Teixeira
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw
More information about the Gtk-sharp-list