Author: ihorko | Posted on: 11/24/2009 4:40:13 PM | Views : 834

Hello,
I need some common function that converts Object value to int. If value is in wrong format and can't convert then return 0.
For this I use next function:
 
public static int ObjToInt(object obj)
        {
            int retVal = 0;
            if (obj == null)
            {
                return retVal;
            }
            int.TryParse(obj.ToString() , out retVal);
            return retVal;
        } Go to the complete details ...