monisha dp

monisha dp

  • NA
  • 12
  • 477

Function to dynamically add two string or add two numbers ?

May 7 2018 4:50 AM
Function to dynamically add two string or add two numbers ?

Answers (1)

0
siddhartha sharna

siddhartha sharna

  • 1.3k
  • 87
  • 15
May 7 2018 10:06 AM
static T Sum<T>(T x, T y)
{
dynamic dx = x, dy = y;
return dx + dy;
}
 
You can call Like : string t = Sum<string>("XYZ", "ABC");