Architecture that extends types using extension methods

Architecture that extends existing types including constructed and sealed types using extension methods. Extension methods are static methods that can be invoked using instance method syntax. Extension methods are declared by specifying the keyword "this" as a modifier on the first paramet...

Ausführliche Beschreibung

Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Meijer, Henricus Johannes Maria, Hejlsberg, Anders, Warren, Matthew J, Bolognese, Luca, Hallam, Peter A, Katzenberger, Gary S, Kulkarni, Dinesh C
Format: Patent
Sprache:eng
Online-Zugang:Volltext bestellen
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
Beschreibung
Zusammenfassung:Architecture that extends existing types including constructed and sealed types using extension methods. Extension methods are static methods that can be invoked using instance method syntax. Extension methods are declared by specifying the keyword "this" as a modifier on the first parameter of the methods. Extension methods have all the capabilities of regular static methods. In addition, once imported, extension methods can be invoked using instance method syntax. Also disclosed are rules for importing extension methods, and extension method invocations. Extension methods are imported through using-namespace-directives. In addition to importing the types contained in a namespace, a using-namespace-directive imports all extension methods in all static classes in the namespace. In effect, imported extension methods appear as additional methods on the types that are given by their first parameter and have lower precedence than regular instance methods.