[Mono-devel-list] Unions in C#, and the Bug# 58798 in GDA
mkestner at novell.com
Fri Apr 15 13:24:36 EDT 2005
On Fri, 2005-04-15 at 11:09 -0500, Daniel Espinosa wrote:
> You know, in C# doesn't exist unions, but you can use the FieldOffset
> attribute at cero, to have a in memory representation of a union. The
> actual definition of GdaValue and "correct" code representation in C#
> can be found the report and comments of the bug# 58798.
You can only use FieldOffset if you are don't mind creating potentially
brittle and platform-dependent assemblies. Besides, I tend to believe
there's a reason unions don't exist in C#. They suck.
Gda.Value is just begging for a manual (more object-oriented)
implementation, similar to what is done with the Gdk.Event union in
While I'm at it, I should mention that Gda# and GnomeDb# are effectively
unmaintained at this point. They should probably be spun off into their
own module(s) where they can either be adopted by somebody or be allowed
to rest in peace. This spinoff is likely to happen before the next
stable release of Gtk#.
> The the parser (a perl script called gapi-parser and the sub scripts,
> specialy the api2xml) need generate a correcto XML file representation
> for a union, and need be modified the C# code for CodeGenerator to
> work around.
Union parsing and generation is an extremely low-priority "feature" at
this point. As I've said above, it's pretty much impossible to do
correctly in C# and in most cases, exposing union-like API in a C#
binding is not the best solution from an object-oriented language
Mike Kestner <mkestner at novell.com>
More information about the Mono-devel-list