Try OpenEdge Now
skip to main content
ABL Reference
Class Properties and Methods Reference : ToString( ) method (Object)
 

ToString( ) method (Object)

Returns information from the specified class or enum instance (both ABL and .NET), depending on the object type.
Return type: CHARACTER
Access: PUBLIC
Applies to: Progress.Lang.Object class, System.Object class (from the .NET Framework)

Syntax

ToString( )
This method is also defined on the .NET root class, System.Object, which overrides the method inherited in the ABL class structure from Progress.Lang.Object.
On an ABL class, or on an ABL-derived .NET class instance that does not override ToString( ), this method returns the fully-qualified class or interface type name of the object followed by a unique object identifier, separated by an underscore. You typically override this method in a user-defined class to provide additional contextual information.
On an ABL enum instance, this method returns the name of the enumeration member. For example, if applied to Progress.Reflect.Flags:Public, the method returns "Public". In the case of a flag enum instance with multiple flags set, the method returns a comma-delimited list of all the flags that are set. If there are no flags set or the underlying numeric value is 0 and there is no flag defined for 0, the method returns the empty string ("").
On a pure .NET class, the information returned depends on the class type. Also, for any System.Object that boxes a .NET mapped data type (such as a System.Int32), the method returns a character string that represents the value of the mapped data type instance. (For more information on .NET mapped data types, see the Data types reference entry.) For all other .NET types, the information returned depends on how the .NET type overrides the ToString( ) method. For example, on a .NET generic type instance, the method returns a string with the following syntax:
namespace.object-nameinteger[type-name [, type-name ] ...]
Where, namespace is the .NET namespace, object-name is the .NET generic class or interface name up to the left angle bracket (<) of the generic type name, integer after the backquote () is the number of type parameters in the generic type, and type-name is the .NET type name substituted for each type parameter in the constructed type. For more information on .NET constructed type names for generic types, see the Data types reference entry.
So, invoking the method on an instance of the following .NET generic type:
"System.Collection.Generic.List<CHARACTER>"
Returns the following string:
System.Collections.Generic.List`1[System.String]
Note: This method is used by some ABL string functions and statements, such as the QUOTER and STRING functions and the MESSAGE and PUT statements.