System.Xml.XmlReader.ReadElementContentAsDecimal()

Here are the examples of the csharp api System.Xml.XmlReader.ReadElementContentAsDecimal() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : Program.cs
with MIT License
from ProfessionalCSharp

public static void ReadDecimal()
        {
            using (XmlReader reader = XmlReader.Create(BooksFileName))
            {
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (reader.Name == "price")
                        {
                            decimal price = reader.ReadElementContentAsDecimal();
                            Console.WriteLine($"Current Price = {price}");
                            price += price * .25m;
                            Console.WriteLine($"New price {price}");
                        }
                        else if (reader.Name == "replacedle")
                        {
                            Console.WriteLine(reader.ReadElementContentreplacedtring());
                        }
                    }
                }
            }
        }