As C# operators e.g. +, +=, == are overridable. It lets me think they are sort of methods, thus wonder if there is a way to call them using reflection, on Int32 for instance.
What about this, it's simple, small and works :)
public T Add<T>(object x, object y)
{
return (T)Convert.ChangeType((dynamic)x + (dynamic)y, typeof(T));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With