You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$10
For Premium members:
In this article I would like to introduce one of new C# 3.0 enhancements “Extension Methods” and so on.
IntroductionIn this article I would like to introduce one of new C# 3.0 enhancements "Extension Methods" and so on. This feature is available in C # 3.0 compilers and further versions (C# 4.0); this feature is very important for all developers especially if you would like to use the dynamism of the C# enhancements to be taken place in your classes design.
public static class MyMathExtension { public static int factorial(this int x) { if (x <= 1) return 1; if (x == 2) return 2; else return x * factorial(x - 1); } }}
ConclusionIn this article, I have stated the use and the benefits we will gain by using extension methods in C# which is available starting from C# 3.0 and further versions of C#.It's important to take care of the tips I have mentioned in the article while you implementing your extension methods.
Pro WPF: Windows Presentation Foundation in .NET 3.0