We are used to use the static method of the class.
public class CommonClass
{
public CommonClass
{
}
public static string ReverseString(string stringToReverse)
{
//Code to reverse the string
}
}
Calling the static method.
MessageBox.Show(CommonClass.ReverseString("DotNetFunda"));
Now, we move to method extension
public static class ExtensionClass
{
public static string ReverseString(this string str)
{
//Code to reverse the string
}
}
Calling
MessageBox.Show("DotNetFunda".ReverseString());