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


C# XmlDictionaryReader.ReadDateTimeArray方法代码示例

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


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

示例1: ReadValue

 public object ReadValue(XmlDictionaryReader reader)
 {
     object value;
     if (_isArray)
     {
         switch (_typeCode)
         {
             case TypeCode.Byte:
                 value = reader.ReadElementContentAsBase64();
                 break;
             case TypeCode.Boolean:
                 if (!reader.IsEmptyElement)
                 {
                     reader.ReadStartElement();
                     value = reader.ReadBooleanArray(_itemName, _itemNamespace);
                     reader.ReadEndElement();
                 }
                 else
                 {
                     reader.Read();
                     value = Array.Empty<bool>();
                 }
                 break;
             case TypeCode.DateTime:
                 if (!reader.IsEmptyElement)
                 {
                     reader.ReadStartElement();
                     value = reader.ReadDateTimeArray(_itemName, _itemNamespace);
                     reader.ReadEndElement();
                 }
                 else
                 {
                     reader.Read();
                     value = Array.Empty<DateTime>();
                 }
                 break;
             case TypeCode.Decimal:
                 if (!reader.IsEmptyElement)
                 {
                     reader.ReadStartElement();
                     value = reader.ReadDecimalArray(_itemName, _itemNamespace);
                     reader.ReadEndElement();
                 }
                 else
                 {
                     reader.Read();
                     value = Array.Empty<Decimal>();
                 }
                 break;
             case TypeCode.Int32:
                 if (!reader.IsEmptyElement)
                 {
                     reader.ReadStartElement();
                     value = reader.ReadInt32Array(_itemName, _itemNamespace);
                     reader.ReadEndElement();
                 }
                 else
                 {
                     reader.Read();
                     value = Array.Empty<Int32>();
                 }
                 break;
             case TypeCode.Int64:
                 if (!reader.IsEmptyElement)
                 {
                     reader.ReadStartElement();
                     value = reader.ReadInt64Array(_itemName, _itemNamespace);
                     reader.ReadEndElement();
                 }
                 else
                 {
                     reader.Read();
                     value = Array.Empty<Int64>();
                 }
                 break;
             case TypeCode.Single:
                 if (!reader.IsEmptyElement)
                 {
                     reader.ReadStartElement();
                     value = reader.ReadSingleArray(_itemName, _itemNamespace);
                     reader.ReadEndElement();
                 }
                 else
                 {
                     reader.Read();
                     value = Array.Empty<Single>();
                 }
                 break;
             case TypeCode.Double:
                 if (!reader.IsEmptyElement)
                 {
                     reader.ReadStartElement();
                     value = reader.ReadDoubleArray(_itemName, _itemNamespace);
                     reader.ReadEndElement();
                 }
                 else
                 {
                     reader.Read();
                     value = Array.Empty<Double>();
                 }
//.........这里部分代码省略.........
开发者ID:shijiaxing,项目名称:wcf,代码行数:101,代码来源:PrimitiveOperationFormatter.cs

示例2: ReadValue


//.........这里部分代码省略.........
                            return reader.ReadElementContentAsDouble();

                        case TypeCode.Decimal:
                            return reader.ReadElementContentAsDecimal();

                        case TypeCode.DateTime:
                            return reader.ReadElementContentAsDateTime();

                        case TypeCode.String:
                            return reader.ReadElementContentAsString();

                        case TypeCode.Boolean:
                            return reader.ReadElementContentAsBoolean();
                    }
                    throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxInvalidUseOfPrimitiveOperationFormatter")));
                }
                switch (this.typeCode)
                {
                    case TypeCode.Boolean:
                        if (reader.IsEmptyElement)
                        {
                            reader.Read();
                            return new bool[0];
                        }
                        reader.ReadStartElement();
                        obj2 = reader.ReadBooleanArray(this.itemName, this.itemNamespace);
                        reader.ReadEndElement();
                        return obj2;

                    case TypeCode.Byte:
                        return reader.ReadElementContentAsBase64();

                    case TypeCode.Int32:
                        if (reader.IsEmptyElement)
                        {
                            reader.Read();
                            return new int[0];
                        }
                        reader.ReadStartElement();
                        obj2 = reader.ReadInt32Array(this.itemName, this.itemNamespace);
                        reader.ReadEndElement();
                        return obj2;

                    case TypeCode.Int64:
                        if (reader.IsEmptyElement)
                        {
                            reader.Read();
                            return new long[0];
                        }
                        reader.ReadStartElement();
                        obj2 = reader.ReadInt64Array(this.itemName, this.itemNamespace);
                        reader.ReadEndElement();
                        return obj2;

                    case TypeCode.Single:
                        if (reader.IsEmptyElement)
                        {
                            reader.Read();
                            return new float[0];
                        }
                        reader.ReadStartElement();
                        obj2 = reader.ReadSingleArray(this.itemName, this.itemNamespace);
                        reader.ReadEndElement();
                        return obj2;

                    case TypeCode.Double:
                        if (reader.IsEmptyElement)
                        {
                            reader.Read();
                            return new double[0];
                        }
                        reader.ReadStartElement();
                        obj2 = reader.ReadDoubleArray(this.itemName, this.itemNamespace);
                        reader.ReadEndElement();
                        return obj2;

                    case TypeCode.Decimal:
                        if (reader.IsEmptyElement)
                        {
                            reader.Read();
                            return new decimal[0];
                        }
                        reader.ReadStartElement();
                        obj2 = reader.ReadDecimalArray(this.itemName, this.itemNamespace);
                        reader.ReadEndElement();
                        return obj2;

                    case TypeCode.DateTime:
                        if (reader.IsEmptyElement)
                        {
                            reader.Read();
                            return new DateTime[0];
                        }
                        reader.ReadStartElement();
                        obj2 = reader.ReadDateTimeArray(this.itemName, this.itemNamespace);
                        reader.ReadEndElement();
                        return obj2;
                }
                throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxInvalidUseOfPrimitiveOperationFormatter")));
            }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:PrimitiveOperationFormatter.cs


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