jeudi 25 février 2016

Testing two object with operator <, <=, etc

Long story short, i have, in C#, a function that posses two "object" (yes the class !) representing potentially a primitive type (excluding bool) and i want to test them. Here is a code to explain it better :

public void Compare(object value1, object value2) {
    if(value1 < value2)
        //do something
    if(value1 > value2)
        // do something else...
 }

But as you may know it's not possible... Is there a way to do it ?

Aucun commentaire:

Enregistrer un commentaire