Introduction
Today, in this article let's play around with one of the interesting and most useful concept in C#.
Question: What are extension methods?
In simple terms "Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type."
Step 1: Create a new console application

Step 2: The complete code of Arithmetic.cs looks like this
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ExtensionMethodsApp
{
public static class Arithmetic
{
public static double Add(this double a, double b)
{
return a + b;
}
public static double Sub(this double a, double b)
{
return a - b;
}
public static double Mul(this double a, double b)



Deepali PatilPosted Oct 15, 2012, 3:16 AM
Hi.Nice article. Can you please tell me the advantages of using extension methods and when should we use it? Thanks:)