ToDouble() static public method

static public ToDouble ( byte buffer, int offset, int count ) : double
buffer byte
offset int
count int
return double
Example #1
0
        public double ToDouble()
        {
            switch (this.type)
            {
            case ValueHandleType.Double:
                return(this.GetDouble());

            case ValueHandleType.Single:
                return((double)this.GetSingle());

            case ValueHandleType.Zero:
                return(0.0);

            case ValueHandleType.One:
                return(1.0);

            case ValueHandleType.Int8:
                return((double)this.GetInt8());

            case ValueHandleType.Int16:
                return((double)this.GetInt16());

            case ValueHandleType.Int32:
                return((double)this.GetInt32());

            case ValueHandleType.UTF8:
                return(XmlConverter.ToDouble(this.bufferReader.Buffer, this.offset, this.length));
            }
            return(XmlConverter.ToDouble(this.GetString()));
        }
Example #2
0
        public double ToDouble()
        {
            ValueHandleType type = _type;

            if (type == ValueHandleType.Double)
            {
                return(GetDouble());
            }
            if (type == ValueHandleType.Single)
            {
                return(GetSingle());
            }
            if (type == ValueHandleType.Zero)
            {
                return(0);
            }
            if (type == ValueHandleType.One)
            {
                return(1);
            }
            if (type == ValueHandleType.Int8)
            {
                return(GetInt8());
            }
            if (type == ValueHandleType.Int16)
            {
                return(GetInt16());
            }
            if (type == ValueHandleType.Int32)
            {
                return(GetInt32());
            }
            if (type == ValueHandleType.UTF8)
            {
                return(XmlConverter.ToDouble(_bufferReader.Buffer, _offset, _length));
            }
            return(XmlConverter.ToDouble(GetString()));
        }