NET 

Custom Attributes

Custom attributes are used to provide additional information about elements within your program. Much of the syntax used in a COBOL program describes program elements, such as the visibility of methods and fields (PUBLIC, PRIVATE, PROTECTED, etc.). All these descriptions are embedded as ‘Metadata’ into the dll or exe file output by the compiler, and can be interrogated by other programs using Reflection. Custom attributes are a way of adding additional metadata to program elements in a way that is open ended and unlimited. Custom attributes are attached to COBOL items using the ATTRIBUTE reserved word.

Custom attributes may be used to describe methods, data items, properties, events, delegates, method parameters, assemblies, classes and method return values.

The arguments you specify for the custom attribute are of two types:


For example:

 01 a binary-long attribute xml("UpperB").

The ordinary parameters used in the custom attribute specification must match a constructor defined by the attribute. In the example above, the constructor expects a single parameter of type string.

As another example:

attribute WebService(NAME Description="My service")

The named parameters must match properties defined by the attribute. In this example, Description is a property of type string defined for the custom attribute class WebService.