Hmm, this may seems a simple question, but I would like to know the fastest way.
I have an object which is a boxed number, I don’t know is it double, int, or some numeric type. I want to check if the boxed value is negative.
I use this conversion but I am not sure if it is as fast as can be:
private bool CheckNegative(object number)
{
return System.Convert.ToDouble(number) < 0;
}
Arsen
It seems like the only way to do it.
But if you wanted to avoid writing multiple functions that take double, int, float, etc to check for negative number, I would redirect you to following post: https://stackoverflow.com/a/828820/150830