当前位置: 首页>>代码示例>>C#>>正文


C# XmlWriter.WriteElementStringAsync方法代码示例

本文整理汇总了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();
        }
开发者ID:Eonix,项目名称:Elmo,代码行数:15,代码来源:ErrorViewBaseMiddleware.cs

示例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);
        }
开发者ID:Eonix,项目名称:Elmo,代码行数:69,代码来源:ErrorDetailViewMiddleware.cs


注:本文中的System.Xml.XmlWriter.WriteElementStringAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。