The naive question I know, and after two years of experience, I was stuck to answer it.
I just need to create a general method, and this method can take int, double, float and compare them and find a larger value:
object ComapreMethod(object obj1, object obj2)
{
if(obj1 > obj2)
{
return obj1;
}
return obj2;
}
I want to call it for int, short, ushort, float, double, ... etc. that I am really stuck on how to compare between obj1 and obj2. I can’t write it, by the way above. I know that it is naive, but I do not know.
Miral source
share