Convert To Int - CSharp System

CSharp examples for System:Converter

Description

Convert To Int

Demo Code


using System.Data.SqlClient;
using System.Data;
using System.Collections.Generic;
using System;//from  w  w  w.  j a  v  a 2s  .  co m

public class Main{
        internal static int ConvertToInt(object value)
        {
            int intValue = 0;
            if (!Convert.IsDBNull(value))
            {
                int.TryParse(value.ToString(), out intValue);
            }
            return intValue;
        }
}

Related Tutorials