To define an extension method:
The following extension method extends the string class, by adding a method to count the number of words in a string:
class-id MyCount static. method-id CountWords extension. *> extension method is implicitly static procedure division using by value str as string returning wordCount as binary-long. set wordCount to str::Split(' ')::Length end method. end class.