System.Xml.XmlConverter.ToDecimal C# (CSharp) Method

ToDecimal() static public method

static public ToDecimal ( string value ) : decimal
value string
return decimal
        static public decimal ToDecimal(string value)
        {
            try
            {
                return XmlConvert.ToDecimal(value);
            }
            catch (ArgumentException exception)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "decimal", exception));
            }
            catch (FormatException exception)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "decimal", exception));
            }
            catch (OverflowException exception)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(value, "decimal", exception));
            }
        }

Same methods

XmlConverter::ToDecimal ( byte buffer, int offset, int count ) : decimal

Usage Example

Esempio n. 1
0
        public decimal ToDecimal()
        {
            ValueHandleType type = _type;

            if (type == ValueHandleType.Decimal)
            {
                return(GetDecimal());
            }
            if (type == ValueHandleType.Zero)
            {
                return(0);
            }
            if (type == ValueHandleType.One)
            {
                return(1);
            }
            if (type >= ValueHandleType.Int8 && type <= ValueHandleType.Int64)
            {
                return(ToLong());
            }
            if (type == ValueHandleType.UInt64)
            {
                return(GetUInt64());
            }
            if (type == ValueHandleType.UTF8)
            {
                return(XmlConverter.ToDecimal(_bufferReader.Buffer, _offset, _length));
            }
            return(XmlConverter.ToDecimal(GetString()));
        }
All Usage Examples Of System.Xml.XmlConverter::ToDecimal