Icon ClassByName

Unit: Internal

Available In: Client and Server Applications

function ClassByName(const Value: String): TClass

The ClassByName function returns the class type whose identifier matches the string input parameter, without case-sensitivity. This function depends upon the run-time type information in client and server applications.

For client applications, the class type declaration must have been compiled with the $RTTI symbol defined in order for the class type to be available to this function. By default, all client applications are compiled with the $RTTI symbol defined, but it is possible for code in the application to undefine the symbol using the $UNDEFINE compiler directive and exclude specific class types from being exposed in the run-time type information.

For server applications, run-time type information is always enabled for all code, and all class type declarations are always available to this function.

If the class type specified does not exist in the run-time type information, the return value will be nil.

Examples

X := ClassByName('TControl');  // X is TControl class type
Image