本文整理匯總了C#中System.Xml.XmlTextReader.ReadContentAsDateTime方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlTextReader.ReadContentAsDateTime方法的具體用法?C# XmlTextReader.ReadContentAsDateTime怎麽用?C# XmlTextReader.ReadContentAsDateTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.XmlTextReader
的用法示例。
在下文中一共展示了XmlTextReader.ReadContentAsDateTime方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Deserialize
public void Deserialize(string str)
{
using (TextReader textReader = new StringReader(str))
using (XmlReader xmlReader = new XmlTextReader(textReader))
{
xmlReader.ReadStartElement();
xmlReader.ReadStartElement();
this.Id = new Guid(xmlReader.ReadContentAsString());
xmlReader.ReadEndElement();
xmlReader.ReadStartElement();
this.Value1 = xmlReader.ReadContentAsInt();
xmlReader.ReadEndElement();
xmlReader.ReadStartElement();
this.Value2 = xmlReader.ReadContentAsDateTime();
xmlReader.ReadEndElement();
xmlReader.ReadStartElement();
this.Value3 = xmlReader.ReadContentAsString();
xmlReader.ReadEndElement();
xmlReader.ReadStartElement();
this.Value4 = xmlReader.ReadContentAsDecimal();
xmlReader.ReadEndElement();
xmlReader.ReadEndElement();
}
}
示例2: LoadAarExplodeCache
/// <summary>
/// Load data cached in aarExplodeDataFile into aarExplodeData.
/// </summary>
private void LoadAarExplodeCache()
{
if (!File.Exists(aarExplodeDataFile)) return;
XmlTextReader reader = new XmlTextReader(new StreamReader(aarExplodeDataFile));
aarExplodeData.Clear();
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element && reader.Name == "aars")
{
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element && reader.Name == "explodeData")
{
string aar = "";
AarExplodeData aarData = new AarExplodeData();
do
{
if (!reader.Read()) break;
if (reader.NodeType == XmlNodeType.Element)
{
string elementName = reader.Name;
if (reader.Read() && reader.NodeType == XmlNodeType.Text)
{
if (elementName == "aar")
{
aar = reader.ReadContentAsString();
}
else if (elementName == "modificationTime")
{
aarData.modificationTime =
reader.ReadContentAsDateTime();
}
else if (elementName == "explode")
{
aarData.explode = reader.ReadContentAsBoolean();
}
else if (elementName == "bundleId")
{
aarData.bundleId = reader.ReadContentAsString();
}
else if (elementName == "path")
{
aarData.path = reader.ReadContentAsString();
}
}
}
} while (!(reader.Name == "explodeData" &&
reader.NodeType == XmlNodeType.EndElement));
if (aar != "") aarExplodeData[aar] = aarData;
}
}
}
}
}