In this we will introduce Extension Methods
What is Extension Methods
1.Extension methods allow an existing type to be extended with new methods without altering the definition of the original type.
2.An extension method is a static method of a static class, where the this modifier is applied to the first parameter.
3.The type of the first parameter will be the type that is extended.
public static class StringHelper
public static bool IsCapitalized (this string s)
if (string.IsNullOrEmpty(s)) return false;
return char.IsUpper (s);
4.The IsCapitalized extension method can be called as though it were an instance method on a string.
String s = "Perth“;
5.An extension method call, when compiled, is translated back into an ordinary static method call.
Console.WriteLine (StringHelper.IsCapitalized (s));
Ambiguity and Resolution about Extension Methods