本文整理汇总了C#中System.Xml.XmlWriter.WriteElementStringAsync方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteElementStringAsync方法的具体用法?C# XmlWriter.WriteElementStringAsync怎么用?C# XmlWriter.WriteElementStringAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.WriteElementStringAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderHeadAsync
private async Task RenderHeadAsync(XmlWriter writer)
{
await writer.WriteStartElementAsync("meta");
await writer.WriteAttributeStringAsync("http-equiv", "X-UA-Compatible");
await writer.WriteAttributeStringAsync("content", "IE=EmulateIE7");
await writer.WriteEndElementAsync();
await writer.WriteElementStringAsync("title", PageTitle);
await writer.WriteStartElementAsync("link");
await writer.WriteAttributeStringAsync("rel", "stylesheet");
await writer.WriteAttributeStringAsync("type", "text/css");
await writer.WriteAttributeStringAsync("href", BasePageName + "/stylesheet");
await writer.WriteEndElementAsync();
}
示例2: RenderDictionaryAsync
private static async Task RenderDictionaryAsync(XmlWriter writer, Dictionary<string, string> dictionary, string id, string title)
{
if (!dictionary.Any())
return;
await writer.WriteStartElementAsync("div");
await writer.WriteAttributeStringAsync("id", id);
{
await writer.WriteStartElementAsync("p");
await writer.WriteAttributeStringAsync("class", "table-caption");
{
await writer.WriteStringAsync(title);
}
await writer.WriteEndElementAsync();
await writer.WriteStartElementAsync("div");
await writer.WriteAttributeStringAsync("class", "scroll-view");
{
await writer.WriteStartElementAsync("table");
{
await writer.WriteStartElementAsync("tr");
{
await writer.WriteStartElementAsync("th");
await writer.WriteAttributeStringAsync("class", "name-col");
{
await writer.WriteStringAsync("Name");
}
await writer.WriteEndElementAsync();
await writer.WriteStartElementAsync("th");
await writer.WriteAttributeStringAsync("class", "value-col");
{
await writer.WriteStringAsync("Value");
}
await writer.WriteEndElementAsync();
}
await writer.WriteEndElementAsync();
var count = 0;
foreach (var line in dictionary)
{
await writer.WriteStartElementAsync("tr");
await writer.WriteAttributeStringAsync("class", count%2 == 0 ? "even-row" : "odd-row");
{
await writer.WriteStartElementAsync("td");
await writer.WriteAttributeStringAsync("class", "key-col");
{
await writer.WriteStringAsync(line.Key);
}
await writer.WriteEndElementAsync();
await writer.WriteStartElementAsync("td");
await writer.WriteAttributeStringAsync("class", "value-col");
{
await writer.WriteStringAsync(line.Value);
}
await writer.WriteEndElementAsync();
}
await writer.WriteEndElementAsync();
}
}
await writer.WriteEndElementAsync();
}
await writer.WriteEndElementAsync();
}
await writer.WriteEndElementAsync();
await writer.WriteElementStringAsync("br", string.Empty);
}