Mega Code Archive

 
Categories / VB.Net / XML
 

XmlReader ReadElementContentAs Method reads the element content as the requested type

Imports System Imports System.IO Imports System.Xml Public Class Sample   Public Shared Sub Main()         Using reader As XmlReader = XmlReader.Create("dataFile.xml")           reader.ReadToFollowing("date")           Dim [date] As DateTime = CType(reader.ReadElementContentAs(GetType(System.DateTime), Nothing), DateTime)                    Console.WriteLine([date].ToLongDateString())         End Using     End Sub End Class