System.Xml.XmlDictionaryReader.ReadElementContentAsUniqueId C# (CSharp) Method

ReadElementContentAsUniqueId() public method

public ReadElementContentAsUniqueId ( ) : UniqueId
return UniqueId
        public virtual UniqueId ReadElementContentAsUniqueId()
        {
            bool isEmptyElement = IsStartElement() && IsEmptyElement;
            UniqueId value;

            if (isEmptyElement)
            {
                Read();
                try
                {
                    value = new UniqueId(string.Empty);
                }
                catch (ArgumentException exception)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(string.Empty, "UniqueId", exception));
                }
                catch (FormatException exception)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlExceptionHelper.CreateConversionException(string.Empty, "UniqueId", exception));
                }
            }
            else
            {
                ReadStartElement();
                value = ReadContentAsUniqueId();
                ReadEndElement();
            }

            return value;
        }

Same methods

XmlDictionaryReader::ReadElementContentAsUniqueId ( ) : System.Xml.UniqueId

Usage Example

        public static MakeConnectionMessageInfo Create(XmlDictionaryReader reader)
        {
            MakeConnectionMessageInfo makeConnectionInfo = new MakeConnectionMessageInfo();

            if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.Name, MakeConnectionConstants.Namespace))
            {
                reader.ReadStartElement();
                reader.MoveToContent();

                while (reader.IsStartElement())
                {
                    if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.AddressElement, MakeConnectionConstants.Namespace))
                    {
                        if (!string.IsNullOrEmpty(makeConnectionInfo.Address))
                        {
                            makeConnectionInfo.MultipleAddressHeaders = true;
                            reader.Skip();
                        }
                        else
                        {
                            makeConnectionInfo.Address = reader.ReadElementContentAsString();
                        }
                    }
                    else if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.IdentifierElement, MakeConnectionConstants.Namespace))
                    {
                        if (makeConnectionInfo.Identifier != null)
                        {
                            makeConnectionInfo.MultipleIdentifierHeaders = true;
                            reader.Skip();
                        }
                        else
                        {
                            makeConnectionInfo.Identifier = reader.ReadElementContentAsUniqueId();
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(makeConnectionInfo.UnknownSelection))
                        {
                            makeConnectionInfo.UnknownSelection = reader.LocalName;
                        }

                        reader.Skip();
                    }
                }

                reader.ReadEndElement();
            }

            return makeConnectionInfo;
        }
All Usage Examples Of System.Xml.XmlDictionaryReader::ReadElementContentAsUniqueId