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>(); } break; default: throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.SFxInvalidUseOfPrimitiveOperationFormatter)); } } else { switch (_typeCode) { case TypeCode.Boolean: value = reader.ReadElementContentAsBoolean(); break; case TypeCode.DateTime: value = reader.ReadElementContentAsDateTime(); break; case TypeCode.Decimal: value = reader.ReadElementContentAsDecimal(); break; case TypeCode.Double: value = reader.ReadElementContentAsDouble(); break; case TypeCode.Int32: value = reader.ReadElementContentAsInt(); break; case TypeCode.Int64: value = reader.ReadElementContentAsLong(); break; case TypeCode.Single: value = reader.ReadElementContentAsFloat(); break; case TypeCode.String: return reader.ReadElementContentAsString(); default: throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.SFxInvalidUseOfPrimitiveOperationFormatter)); } } return value; }
public object ReadValue(XmlDictionaryReader reader) { object obj2; if (!this.isArray) { switch (this.typeCode) { case TypeCode.Int32: return reader.ReadElementContentAsInt(); case TypeCode.Int64: return reader.ReadElementContentAsLong(); case TypeCode.Single: return reader.ReadElementContentAsFloat(); case TypeCode.Double: 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"))); }