System.Xml.XmlReader.ReadContentAsInt C# (CSharp) Méthode

ReadContentAsInt() public méthode

public ReadContentAsInt ( ) : int
Résultat int
        public virtual int ReadContentAsInt()
        {
            if (!CanReadContentAs())
            {
                throw CreateReadContentAsException(nameof(ReadContentAsInt));
            }
            try
            {
                return XmlConvert.ToInt32(InternalReadContentAsString());
            }
            catch (FormatException e)
            {
                throw new XmlException(SR.Xml_ReadContentAsFormatException, "Int", e, this as IXmlLineInfo);
            }
        }

Usage Example

Exemple #1
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "label":
     this.Label = reader.Value;
     continue;
       case "width":
     this.Width = reader.ReadContentAsInt();
     continue;
       case "height":
     this.Height = reader.ReadContentAsInt();
     continue;
       case "source":
     this.Source = reader.Value;
     continue;
       case "url":
     this.Url = reader.Value;
     continue;
       case "media":
     this.MediaType = reader.Value == "photo" ? MediaType.Photos : MediaType.Videos;
     continue;
       default:
     continue;
     }
       }
       reader.Read();
 }
All Usage Examples Of System.Xml.XmlReader::ReadContentAsInt