Extension
An extension is a language feature that lets functionality be defined outside a type's original declaration and called using that type's member-like syntax, without modifying the type.
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 →
Also covered in
- Building Distributed Applications that Work
- F# in Action: A Revised Edition of Get Programming with F#
What to know first
- interfaceAn interface is a contract or boundary that specifies the operations, members, or data shape a type or component exposes, without prescribing its complete implementation.
- object-oriented programmingObject-oriented programming is a programming paradigm that organizes software around objects combining state and behavior, often using encapsulation, classes, inheritance, or polymorphism.
- listA list is an ordered collection of elements arranged in a sequence.
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
Related concepts
- functionkind of · A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- receiveruses · A receiver is an entity or value designated to accept a message, signal, or operation.
- Selectincludes · Select is a LINQ sequence operator that applies a selector to each element and returns the resulting projected sequence.
- static classpart of · A static class is a class whose members belong to the type rather than to instances and that cannot be instantiated.
- this pointerconfigured by · The this pointer is a language-provided reference to the current object instance in an instance method or related operation.
Questions about extension
What is extension?
An extension is a language feature that lets functionality be defined outside a type's original declaration and called using that type's member-like syntax, without modifying the type.
Which Manning books explain extension?
Kotlin in Action, 2E, Functional Programming in Scala, Second Edition, .NET in Action, Second Edition, Fabulous Adventures in Data Structures and Algorithms and Pro ASP.NET Core 7, Tenth Edition.
What should I know before learning extension?
Manning books that teach extension usually introduce interface, object-oriented programming, list and array first.
What kinds of extension are there?
Kinds of extension include Select and to function.
What is extension a kind of?
Extension is a kind of function. A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
What is extension part of?
Extension is part of static class. A static class is a class whose members belong to the type rather than to instances and that cannot be instantiated.
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.




