Extend Existing Objects Functionalities with C# Extension Methods

preview_player
Показать описание
With C# extension methods you can extend objects that you might not even have the source code from! In this video we will learn what extension methods are, how to use them and how to create one yourself!

💝 Join this channel to get access to perks:

Disclaimer: this channel is done on personal title, in my free time, and not officially affiliated with or endorsed by Microsoft (my employer) in any way. Opinions and views are my own.

🔗 Links

⏱ Timestamps
00:00 - Intro
00:12 - Sample App Outline
01:33 - Implement Sample Code
02:59 - Implement Extension Method
06:17 - Important Note on Discoverability
07:34 - Use Extension Method as Regular Method
09:17 - Outro

🙋‍♂️ Also find my...

#csharp #extensionmethod #dotnet
Рекомендации по теме
Комментарии
Автор

For extra crazy fun, attach extension methods to an Interface. Then you can reference that Interface in multiple Classes, and have access to the extension methods in each. A little hack for when you *really* wanted to use multiple inheritance in C# ;)

KenRossPhotography
Автор

Great feature, which I had already forgotten! More of these tips, please :)

anttipellinen
Автор

what are the differences or benefits of using extension methods vs inject dependency ?

EdRawrDev
Автор

Nice, is there something similar for attributes? I often find myself inheriting framework classes just to add few extra attributes

darrabam
Автор

love_Learn_With( " Gerald " ) ;

HakamElkady
welcome to shbcf.ru