Using both Is and As together

Often using both Is and As together is not required and expensive.

The following code can be optimised to make use of casting:

  If ActiveControl is TEdit then
    (ActiveControl as TEdit).Caption:=’test’;


It is more efficient to say :

  If ActiveControl is TEdit then
    TEdit(ActiveControl).Caption:=’test’;

eyebol provides this as a suggestion that can be applied automatically.


< Back to list of hints and warnings