Extension Function

Noun · Development

Definitions

  1. A function that adds new behavior to an existing class without modifying its source code or using inheritance. Kotlin and C# support extension functions natively, calling them as if they were methods on the class.

    In plain English: Adding a new trick to an existing type without changing its original code — like teaching someone else's dog a new command.

    Example: "We wrote a String.toSlug() extension function so every string in the project can slugify itself."

Related Terms