[Gtk-sharp-list] Glade example code
Jonathan Pryor
jonpryor@vt.edu
Sat, 07 Feb 2004 18:44:13 -0500
Below...
On Sat, 2004-02-07 at 10:57, Ian Pointer wrote:
<snip/>
> [Glade.Widget] Button button1;
>
> I get that this somehow connects the new GtkButton object to the one in
> the Glade file, but, uh, how does it do it? If you could just give me
> the name of the language feature being used so I could go and search
> for it, it would be a great help 8-).
That's an Attribute. Attributes can be attached to most language
constructs except for local variables -- classes, structures,
interfaces, fields, events, properties, methods, assemblies, etc.
You can query for the attributes attached to an item at runtime by using
System.Attribute.GetCustomAttribute or
System.Reflection.ICustomAttributeProvider.GetCustomAttributes.
ICustomAttributeProvider is implemented by System.Type and many of the
classes in the System.Reflection namespace, such as MethodInfo and
FieldInfo.
- Jon