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


C# XmlReader.ReadElementContentAsNullable方法代码示例

本文整理汇总了C#中XmlReader.ReadElementContentAsNullable方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadElementContentAsNullable方法的具体用法?C# XmlReader.ReadElementContentAsNullable怎么用?C# XmlReader.ReadElementContentAsNullable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlReader的用法示例。


在下文中一共展示了XmlReader.ReadElementContentAsNullable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseXml

        internal static MarketplaceAppEntryNode ParseXml(XmlReader reader)
        {
            var node = new MarketplaceAppEntryNode();

            reader.ReadStartElement();

            while (reader.NodeType != XmlNodeType.EndElement)
            {
                switch (reader.Name)
                {
                    case "a:updated":
                        node.Updated = reader.ReadElementContentAsNullable<DateTime>();
                        break;

                    case "a:title":
                        node.Title = MarketplaceAppContentNode.ParseXml(reader);
                        break;

                    case "a:id":
                        node.Id = reader.ReadElementContentAsUrn();
                        break;

                    case "version":
                        node.Version = reader.ReadElementContentAsString();
                        break;

                    case "payloadId":
                        node.PayloadId = reader.ReadElementContentAsUrn();
                        break;

                    case "skuId":
                        node.SkuId = reader.ReadElementContentAsUrn();
                        break;

                    case "skuLastUpdated":
                        node.SkuLastUpdated = reader.ReadElementContentAsNullable<DateTime>();
                        break;

                    case "isAvailableInCountry":
                        node.IsAvailableInCountry = reader.ReadElementContentAsBoolean();
                        break;

                    case "isAvailableInStore":
                        node.IsAvailableInStore = reader.ReadElementContentAsBoolean();
                        break;

                    case "isClientTypeCompatible":
                        node.IsClientTypeCompatible = reader.ReadElementContentAsBoolean();
                        break;

                    case "isHardwareCompatible":
                        node.IsHardwareCompatible = reader.ReadElementContentAsBoolean();
                        break;

                    case "isBlacklisted":
                        node.IsBlacklisted = reader.ReadElementContentAsBoolean();
                        break;

                    case "url":
                        node.Url = reader.ReadElementContentAsString();
                        break;

                    case "packageSize":
                        node.PackageSize = reader.ReadElementContentAsInt();
                        break;

                    case "installSize":
                        node.InstallSize = reader.ReadElementContentAsInt();
                        break;

                    case "clientTypes":
                        node.ClientTypes = reader.ReadElementContentAsArray(x => x.ReadElementContentAsString());
                        break;

                    case "supportedLanguages":
                        node.SupportedLanguages = reader.ReadElementContentAsArray(x => x.ReadElementContentAsString());
                        break;

                    case "deviceCapabilities":
                        var deviceCapabilitiesString = reader.ReadElementContentAsString();

                        if (!string.IsNullOrEmpty(deviceCapabilitiesString))
                        {
                            deviceCapabilitiesString = string.Format("<root>{0}</root>", HttpUtility.HtmlDecode(deviceCapabilitiesString));

                            using (var stringReader = new StringReader(deviceCapabilitiesString))
                            {
                                using (var reader2 = XmlReader.Create(stringReader))
                                {
                                    reader2.ReadStartElement();

                                    node.DeviceCapabilities = MarketplaceAppCapabilitiesNode.ParseXml(reader2);

                                    reader2.ReadEndElement();
                                }
                            }
                        }
                        break;

                    default:
//.........这里部分代码省略.........
开发者ID:Cimbalino,项目名称:Cimbalino-Phone-Toolkit,代码行数:101,代码来源:MarketplaceAppEntryNode.cs


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