System.Xml.XmlConverter.ToBoolean C# (CSharp) Méthode

ToBoolean() static public méthode

static public ToBoolean ( byte buffer, int offset, int count ) : bool
buffer byte
offset int
count int
Résultat bool
        static public bool ToBoolean(byte[] buffer, int offset, int count)
        {
            if (count == 1)
            {
                byte ch = buffer[offset];
                if (ch == (byte)'1')
                    return true;
                else if (ch == (byte)'0')
                    return false;
            }
            return ToBoolean(ToString(buffer, offset, count));
        }

Same methods

XmlConverter::ToBoolean ( string value ) : bool

Usage Example

Exemple #1
0
        public bool ToBoolean()
        {
            ValueHandleType type = _type;

            if (type == ValueHandleType.False)
            {
                return(false);
            }
            if (type == ValueHandleType.True)
            {
                return(true);
            }
            if (type == ValueHandleType.UTF8)
            {
                return(XmlConverter.ToBoolean(_bufferReader.Buffer, _offset, _length));
            }
            if (type == ValueHandleType.Int8)
            {
                int value = GetInt8();
                if (value == 0)
                {
                    return(false);
                }
                if (value == 1)
                {
                    return(true);
                }
            }
            return(XmlConverter.ToBoolean(GetString()));
        }
All Usage Examples Of System.Xml.XmlConverter::ToBoolean