Opc.Ua.XmlEncoder.WriteLocalizedText C# (CSharp) Method

WriteLocalizedText() public method

Writes an LocalizedText to the stream.
public WriteLocalizedText ( string fieldName, Opc.Ua.LocalizedText value ) : void
fieldName string
value Opc.Ua.LocalizedText
return void
        public void WriteLocalizedText(string fieldName, LocalizedText value)
        {
            if (BeginField(fieldName, value == null, true))
            {
                PushNamespace(Namespaces.OpcUaXsd);
                
                if (value != null)
                {
                    WriteString("Locale", value.Locale);
                    WriteString("Text", value.Text);
                }

                PopNamespace();
                
                EndField(fieldName);
            }
        }

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Saves the attributes from the stream.
        /// </summary>
        /// <param name="context">The context for the system being accessed.</param>
        /// <param name="encoder">The encoder wrapping the stream to write.</param>
        public override void Save(ISystemContext context, XmlEncoder encoder)
        {
            base.Save(context, encoder);

            encoder.PushNamespace(Namespaces.OpcUaXsd);

            if (!LocalizedText.IsNullOrEmpty(m_inverseName))
            {
                encoder.WriteLocalizedText("InverseName", m_inverseName);
            }

            if (m_symmetric)
            {
                encoder.WriteBoolean("Symmetric", m_symmetric);
            }

            encoder.PopNamespace();
        }