What is the extension methods in C#? code example
Example: define extension methods c#
public static class MyExtensions
{
//use the this keyword before an argument
public static int WordCount(this String str)
{
return str.Split(new char[] { ' ', '.', '?' },
StringSplitOptions.RemoveEmptyEntries).Length;
}
}