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())); }
public bool ToBoolean() { ValueHandleType type = this.type; switch (type) { case ValueHandleType.False: return(false); case ValueHandleType.True: return(true); case ValueHandleType.UTF8: return(XmlConverter.ToBoolean(this.bufferReader.Buffer, this.offset, this.length)); } if (type == ValueHandleType.Int8) { switch (this.GetInt8()) { case 0: return(false); case 1: return(true); } } return(XmlConverter.ToBoolean(this.GetString())); }