For Microsoft Kool-Aid Drinkers, Non-paid MS Evangelists written by a Senior Consultant, Passionate about Tech

All posts tagged extension methods

Ever wish you had a way to pad a string with spaces or multiply a number by 2 or 3 without having to write out all the syntax every time you needed it?  What if strings or integers just had functions built in to do the little extras that maybe your application does repetitive times throughout your code?

Well, in C#, you can use extension methods to enhance your experience.  Extension methods allow you to add functionality to existing types such as string, integers, etc.. Even sealed types are supported. They are declared as static methods and you can use them for interfaces and constructed types.

Let’s get started…

Read more