Custom Attributes are descriptive tags that provide additional information about programming elements such as classes, fields, methods, and properties. Other applications, such as the Visual RPG compiler or the Visual Studio designers, can refer to the extra information in attributes to determine how these items can be used at design-time and run-time.
Attributes are saved with the metadata of Visual RPG assemblies. Metadata is information that describes every element managed by the system runtime. This includes information required for debugging and garbage collection, as well as security attributes, marshaling data, extended class and member definitions, version binding, and any other information the runtime requires.
With attributes, you specify the metadata in much the same way as you use special values like *Public and *Private to provide information about Access levels. However, unlike special values, most attributes are not Visual RPG-specific. Using attributes, you can extend the capabilities of the Visual RPG language without requiring changes to the compiler.
Some key points about attributes include:
The following commands have a new optional keyword call Attributes which allow you to provide one or more attributes on the object being defined by the command. To specify more than one attribute, simply separate them with commas.
You can also add attributes to the assembly by using the new command:
SetAssemblyAttribute Attribute( attr )
To specify more than one attribute for the assembly use multiple SetAssemblyAttribute commands. This command can be coded in any of you classes but must be come before the BEGCLASS and after any USING statements.
It is common to create a dedicated source file called AssemblyInfo.vr where all assembly attributes are grouped. This file usually lacks a class definition, i.e.: it contains no BegClass whatsoever.