System.Xml.XmlReader.ReadElementContentAsString C# (CSharp) Method

ReadElementContentAsString() public method

public ReadElementContentAsString ( string localName, string namespaceURI ) : string
localName string
namespaceURI string
return string
        public virtual string ReadElementContentAsString(string localName, string namespaceURI)
        {
            CheckElement(localName, namespaceURI);
            return ReadElementContentAsString();
        }

Same methods

XmlReader::ReadElementContentAsString ( ) : string

Usage Example

Beispiel #1
0
        public ExamQuestion(XmlReader reader)
            : this()
        {
            QuestionIdentifier = reader.GetAttribute("identifier");
            Question = reader.GetAttribute("question");
            Image = reader.GetAttribute("image");

            while (!reader.EOF)
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        if (reader.Name == "Answer")
                            Answer = reader.ReadElementContentAsString();
                        else if (reader.Name == "Distractor")
                            Distractors.Add(reader.ReadElementContentAsString());
                        else
                            reader.Read();
                        break;
                    case XmlNodeType.EndElement:
                        return;
                    default:
                        reader.Read();
                        break;
                }
            }
        }
All Usage Examples Of System.Xml.XmlReader::ReadElementContentAsString