Extension
An extension is a language feature that adds functionality to an existing type without modifying its original definition.
Kotlin in Action, 2E
An extension function is a Kotlin function defined outside a class that can be called with member-like syntax on values of an existing receiver type.
- How it is used
- Adapts existing Java and external APIs to idiomatic Kotlin member-like calls without rewriting their classes.
- How deep it goes
- Explains declaration, receivers, Java compilation, static dispatch, nullable receivers, and utility design; defers subclass syntax details.
- Examples
- Demonstrates String.lastChar, Collection.joinToString, User validation, nullable String checks, View/Button dispatch, and site-visit averages.
- What you can do after
- Apply it to add focused utilities and API adapters while avoiding assumptions about overriding or private-member access.
Functional Programming in Scala, Second Edition
An extension method is a method defined outside a type's original declaration that can be invoked with object-oriented syntax on values of that type.
- How it is used
- Adds object-oriented call syntax to functions defined separately from an algebraic data type.
- How deep it goes
- Explains method-versus-function tradeoffs, type specialization, receiver binding, compiler lookup, and companion-object placement.
- Examples
- Uses recursive `Tree` operations: generic `size` and integer-specific `firstPositive`.
- What you can do after
- Apply it via Scala extension syntax to add type-specific operations without editing the original type declaration.
Read how Functional Programming in Scala, Second Edition explains extension →
.NET in Action, Second Edition
An extension method is a static method that can be invoked with instance-method syntax on a type without modifying or inheriting from that type.
- How it is used
- Uses extension methods to add fluent behavior to existing types in a console application's command-line parsing workflow.
- How deep it goes
- Defines declaration syntax, invocation syntax, chaining, and visibility limits through focused C# examples.
- Examples
- Uses EveryOtherCharacter on string values and WithParsed or WithNotParsed on ParserResult objects.
- What you can do after
- Build it from scratch by defining a static extension class and invoking its method with instance syntax.
Read how .NET in Action, Second Edition explains extension →
Fabulous Adventures in Data Structures and Algorithms
An extension method is a statically declared method that can be invoked with instance-method syntax on a type without modifying that type.
- How it is used
- Uses static methods to extend interfaces and abstractions without enlarging their contracts or modifying their implementations.
- How deep it goes
- Demonstrates syntax, interface-design consequences, fluent composition, and concrete implementations, but does not develop compiler-resolution rules.
- Examples
- Uses immutable stacks, memoizing quadtrees, random distributions, histograms, sample sequences, and Euclid’s GCD algorithm.
- What you can do after
- Build extension-based APIs that preserve compact interfaces, support fluent calls, and reuse operations across related types.
Read how Fabulous Adventures in Data Structures and Algorithms explains extension →
Pro ASP.NET Core 7, Tenth Edition
An extension method is a statically defined method that can be invoked with instance-method syntax on a type without modifying that type's definition.
- How it is used
- Adds application behavior to Microsoft, third-party, or otherwise unmodifiable types while retaining convenient instance-method syntax.
- How deep it goes
- Defines static classes, this parameters, interface targets, nullable handling, and yield-based filtering, but does not discuss compiler transformation internals.
- Examples
- Uses ShoppingCart, Product arrays, TotalPrices, FilterByPrice, controller actions, browser URLs, and displayed currency totals.
- What you can do after
- Build new operations for inaccessible classes, reuse them across interface implementations, and compose filtering with aggregation.
Read how Pro ASP.NET Core 7, Tenth Edition explains extension →
Related concepts
- this pointerconfigured by · The this pointer is a language-provided reference to the current object instance in an instance method or related operation.
- receiveruses · A receiver is an entity that accepts a message or signal, or an object on which a method or command operates.
- functionkind of · A function is a defined operation that maps inputs to outputs and, when implemented as a callable program unit, may also produce effects.
- concatenationincludes · Concatenation is the operation of combining values or ordered sequences into a single composite, typically preserving their order.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




