Here for adding , I am using generic variables. using these generic variables we can add any type of data.
Ex: int, string, decimal, double etc..
Add<string>("dotnet ", "funda");
Add<int>(5, 1);
public class GenericClass
{
static void Main(string[] args)
{
Add<decimal>(5.5m, 10);
}
static void Add<T>(T a, T b)
{
Console.WriteLine((dynamic)a + (dynamic)b); Console.ReadKey();
}
}