Opc.Ua.XmlDecoder.ReadBoolean C# (CSharp) Method

ReadBoolean() public method

Reads a boolean from the stream.
public ReadBoolean ( string fieldName ) : bool
fieldName string
return bool
        public bool ReadBoolean(string fieldName)
        {
            if (BeginField(fieldName, true))
            {
                string xml = ReadString();

                if (!String.IsNullOrEmpty(xml))
                {
                    bool value = XmlConvert.ToBoolean(xml.ToLowerInvariant());
                    EndField(fieldName);
                    return value;
                }
            }

            return false;
        }
        

Usage Example

コード例 #1
0
        /// <summary>
        /// Updates the attributes from the stream.
        /// </summary>
        /// <param name="context">The context for the system being accessed.</param>
        /// <param name="decoder">The decoder wrapping the stream to read.</param>
        public override void Update(ISystemContext context, XmlDecoder decoder)
        {
            base.Update(context, decoder);

            decoder.PushNamespace(Namespaces.OpcUaXsd);

            if (decoder.Peek("Executable"))
            {
                Executable = decoder.ReadBoolean("Executable");
            }

            if (decoder.Peek("UserExecutable"))
            {
                UserExecutable = decoder.ReadBoolean("UserExecutable");
            }

            decoder.PopNamespace();
        }
All Usage Examples Of Opc.Ua.XmlDecoder::ReadBoolean