Attributes
From The Oxygene Language Wiki
This is a Language topic
Feel free to add your notes to this topic below.
Delphi Prism provides full support for .NET Attributes, using the familiar "square brackets" syntax. An attribute is a tag you can apply to the assembly itself, the current module, a type or member of type. Attributes are types that descend from System.Attribute; when querying for attributes, the runtime will instantiate them by calling the constructor with the parameter specified in the call. There is an attribute called AttributeUsageAttribute that's applied to attributes to state where they can be applied.
type DebugHelper = public class public [Conditional('DEBUG')] class method DebugOutput(data: string); end;
Conventionally, all attribute type names end with 'Attribute', the compiler will try find a type by the attribute name with 'Attribute' added first, if it fails it will try to find a type named as typed. In the above sample the attribute used is called "ConditionalAttribute".
See Also
Area: Oxygene Language
Compiler version: Oxygene 5
Language Glossary — Keywords — Types — FAQ — How To