Extension Methods
From RemObjects Software
This is a Oxygene Language Feature topic
Feel free to add your notes to this topic below.
New in .NET 3.0 and 'Joyride'.
Using Extension Methods
The namespace an Extension method-class is defined in has to be in the uses list. The new 3.5 runtime comes with System.Core.dll that provides several extension methods for the IEnumerable<T> interface exposing functions like searching for a subset, returning the first or last element and grouping them.
Writing Extension Methods
See Extension Methods (Writing) for information on writing extension methods.
LINQ and Extension Methods
LINQ doesn't have a hardcoded set of classes it uses for the methods that are called when using LINQ operations on something. Instead it tries to find a method or extension method on the class matching the name. For example: a where condition tries to call a method called "Where", select calls "Select". This approach makes it possible to use LINQ on any kind of class as long as there are extension methods for it.
Product: RemObjects Oxygene (formerly known as Chrome)
Current version: 3.0
Previous Versions: 'Joyride' (2.0), 'Floorshow' (1.5), 'Adrenochrome' (1.0)
Glossary — Keywords — Language Features — Platform Features — Samples — Articles — How To — Issues
Categories: Text | Oxygene | Feature
