[RESOLVED]extension OrDBNull for int type

HI

is there something wrong with my code? I’ve build this method for null int type but I suspect that when there is a int type > 0, this code is not returning the int. Does anyone see anything wrong with this code?

public static object OrDBNull(this int? i) {
        return (i == null || i == 0) ? (object)DBNull.Value : (object)i;
    }

Sorry, I alread find my error in other place.

disconsider this topic.

Leave a Reply