Convert To Decimal - CSharp System

CSharp examples for System:Converter

Description

Convert To Decimal

Demo Code


using System.Data.SqlClient;
using System.Data;
using System.Collections.Generic;
using System;//from w w  w.  ja  va  2  s.c om

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

Related Tutorials