System\Xml\Schema\DataTypeImplementation.cs (26)
1104string[] splitString = XmlConvert.SplitString(s);
1120string[] splitString = XmlConvert.SplitString(s);
1536exception = XmlConvert.TryToBoolean(s, out boolValue);
1619exception = XmlConvert.TryToSingle(s, out singleValue);
1704exception = XmlConvert.TryToDouble(s, out doubleValue);
1797exception = XmlConvert.TryToDecimal(s, out decimalValue);
1889exception = XmlConvert.TryToTimeSpan(s, out timeSpanValue);
2424byteArrayValue = XmlConvert.FromBinHexString(s, false);
2624exception = XmlConvert.TryToUri(s, out uri);
3122exception = XmlConvert.TryToInteger(s, out decimalValue);
3238exception = XmlConvert.TryToInt64(s, out int64Value);
3292exception = XmlConvert.TryToInt32(s, out int32Value);
3347exception = XmlConvert.TryToInt16(s, out int16Value);
3401exception = XmlConvert.TryToSByte(s, out sbyteValue);
3487exception = XmlConvert.TryToUInt64(s, out uint64Value);
3541exception = XmlConvert.TryToUInt32(s, out uint32Value);
3595exception = XmlConvert.TryToUInt16(s, out uint16Value);
3648exception = XmlConvert.TryToByte(s, out byteValue);
3693value = XmlConvert.ToDouble(s);
3715value = XmlConvert.ToSingle(s);
3785return XmlConvert.ToChar(s);
3804exception = XmlConvert.TryToChar(s, out charValue);
3824decimal value = XmlConvert.ToDecimal(s);
3849exception = XmlConvert.TryToDecimal(s, out decimalValue);
3881return XmlConvert.ToGuid(s);
3900exception = XmlConvert.TryToGuid(s, out guid);
System\Xml\Schema\XmlValueConverter.cs (105)
524return Convert.FromBase64String(XmlConvert.TrimString(value));
612return XmlConvert.FromBinHexString(value.AsSpan().Trim(XmlConvert.WhitespaceChars), false);
803throw new OverflowException(SR.Format(SR.XmlConvert_Overflow, new string[] { XmlConvert.ToString(value), "Int32" }));
811throw new OverflowException(SR.Format(SR.XmlConvert_Overflow, new string[] { XmlConvert.ToString(value), "Int64" }));
819throw new OverflowException(SR.Format(SR.XmlConvert_Overflow, new string[] { XmlConvert.ToString(value), "UInt64" }));
827throw new OverflowException(SR.Format(SR.XmlConvert_Overflow, new string[] { XmlConvert.ToString(value), "Byte" }));
835throw new OverflowException(SR.Format(SR.XmlConvert_Overflow, new string[] { XmlConvert.ToString(value), "Int16" }));
843throw new OverflowException(SR.Format(SR.XmlConvert_Overflow, new string[] { XmlConvert.ToString(value), "SByte" }));
851throw new OverflowException(SR.Format(SR.XmlConvert_Overflow, new string[] { XmlConvert.ToString(value), "UInt16" }));
859throw new OverflowException(SR.Format(SR.XmlConvert_Overflow, new string[] { XmlConvert.ToString(value), "Int32" }));
867throw new OverflowException(SR.Format(SR.XmlConvert_Overflow, new string[] { XmlConvert.ToString(value), "UInt32" }));
899if (TypeCode == XmlTypeCode.Decimal) return XmlConvert.ToDecimal((string)value);
900return XmlConvert.ToInteger((string)value);
924if (TypeCode == XmlTypeCode.Decimal) return DecimalToInt32(XmlConvert.ToDecimal((string)value));
925return XmlConvert.ToInt32((string)value);
949if (TypeCode == XmlTypeCode.Decimal) return DecimalToInt64(XmlConvert.ToDecimal((string)value));
950return XmlConvert.ToInt64((string)value);
981if (TypeCode == XmlTypeCode.Decimal) return XmlConvert.ToString((decimal)value);
982return XmlConvert.ToString(decimal.Truncate((decimal)value));
986return XmlConvert.ToString((int)value);
990return XmlConvert.ToString((long)value);
999if (sourceType == Int32Type) return XmlConvert.ToString((int)value);
1000if (sourceType == Int64Type) return XmlConvert.ToString((long)value);
1035if (destinationType == StringType) return XmlConvert.ToString((int)value);
1050if (destinationType == StringType) return XmlConvert.ToString((long)value);
1165if (TypeCode == XmlTypeCode.Float) return ((double)XmlConvert.ToSingle((string)value));
1166return XmlConvert.ToDouble((string)value);
1209if (TypeCode == XmlTypeCode.Float) return XmlConvert.ToSingle((string)value);
1210return ((float)XmlConvert.ToDouble((string)value));
1233if (TypeCode == XmlTypeCode.Float) return XmlConvert.ToString(ToSingle((double)value));
1234return XmlConvert.ToString((double)value);
1238if (TypeCode == XmlTypeCode.Float) return XmlConvert.ToString((float)value);
1239return XmlConvert.ToString((double)(float)value);
1568return XmlConvert.ToBoolean((string)value);
1577if (sourceType == StringType) return XmlConvert.ToBoolean((string)value);
1632return XmlConvert.ToString((bool)value);
1640if (sourceType == BooleanType) return XmlConvert.ToString((bool)value);
1658if (destinationType == StringType) return XmlConvert.ToString((bool)value);
1671if (destinationType == BooleanType) return XmlConvert.ToBoolean((string)value);
1730case XmlTypeCode.HexBinary: return XmlConvert.ToBinHexString((byte[])value);
1793if (destinationType == UriType) if (TypeCode == XmlTypeCode.AnyUri) return XmlConvert.ToUri((string)value);
1869if (sourceType == StringType) if (TypeCode == XmlTypeCode.AnyUri) return XmlConvert.ToUri((string)value);
2030return XmlConvert.ToBoolean((string)value);
2038if (sourceType == StringType) return XmlConvert.ToBoolean((string)value);
2095return XmlConvert.ToDecimal((string)value);
2103if (sourceType == StringType) return XmlConvert.ToDecimal((string)value);
2117return XmlConvert.ToDouble((string)value);
2125if (sourceType == StringType) return XmlConvert.ToDouble((string)value);
2139return XmlConvert.ToInt32((string)value);
2147if (sourceType == StringType) return XmlConvert.ToInt32((string)value);
2161return XmlConvert.ToInt64((string)value);
2169if (sourceType == StringType) return XmlConvert.ToInt64((string)value);
2183return XmlConvert.ToSingle((string)value);
2191if (sourceType == StringType) return XmlConvert.ToSingle((string)value);
2203return XmlConvert.ToString((bool)value);
2215return XmlConvert.ToString((decimal)value);
2219return XmlConvert.ToString((double)value);
2223return XmlConvert.ToString((int)value);
2227return XmlConvert.ToString((long)value);
2231return XmlConvert.ToString((float)value);
2239if (sourceType == BooleanType) return XmlConvert.ToString((bool)value);
2240if (sourceType == ByteType) return XmlConvert.ToString((byte)value);
2244if (sourceType == DecimalType) return XmlConvert.ToString((decimal)value);
2245if (sourceType == DoubleType) return XmlConvert.ToString((double)value);
2246if (sourceType == Int16Type) return XmlConvert.ToString((short)value);
2247if (sourceType == Int32Type) return XmlConvert.ToString((int)value);
2248if (sourceType == Int64Type) return XmlConvert.ToString((long)value);
2249if (sourceType == SByteType) return XmlConvert.ToString((sbyte)value);
2250if (sourceType == SingleType) return XmlConvert.ToString((float)value);
2253if (sourceType == UInt16Type) return XmlConvert.ToString((ushort)value);
2254if (sourceType == UInt32Type) return XmlConvert.ToString((uint)value);
2255if (sourceType == UInt64Type) return XmlConvert.ToString((ulong)value);
2273if (destinationType == StringType) return XmlConvert.ToString((bool)value);
2293if (destinationType == StringType) return XmlConvert.ToString((decimal)value);
2303if (destinationType == StringType) return XmlConvert.ToString((double)value);
2313if (destinationType == StringType) return XmlConvert.ToString((int)value);
2323if (destinationType == StringType) return XmlConvert.ToString((long)value);
2334if (destinationType == BooleanType) return XmlConvert.ToBoolean((string)value);
2335if (destinationType == ByteType) return Int32ToByte(XmlConvert.ToInt32((string)value));
2339if (destinationType == DecimalType) return XmlConvert.ToDecimal((string)value);
2340if (destinationType == DoubleType) return XmlConvert.ToDouble((string)value);
2341if (destinationType == Int16Type) return Int32ToInt16(XmlConvert.ToInt32((string)value));
2342if (destinationType == Int32Type) return XmlConvert.ToInt32((string)value);
2343if (destinationType == Int64Type) return XmlConvert.ToInt64((string)value);
2344if (destinationType == SByteType) return Int32ToSByte(XmlConvert.ToInt32((string)value));
2345if (destinationType == SingleType) return XmlConvert.ToSingle((string)value);
2347if (destinationType == UInt16Type) return Int32ToUInt16(XmlConvert.ToInt32((string)value));
2348if (destinationType == UInt32Type) return Int64ToUInt32(XmlConvert.ToInt64((string)value));
2349if (destinationType == UInt64Type) return DecimalToUInt64(XmlConvert.ToDecimal((string)value));
2350if (destinationType == UriType) return XmlConvert.ToUri((string)value);
2369if (sourceType == StringType) return XmlConvert.ToBoolean((string)value);
2373if (sourceType == StringType) return Int32ToByte(XmlConvert.ToInt32((string)value));
2389if (sourceType == StringType) return XmlConvert.ToDecimal((string)value);
2393if (sourceType == StringType) return XmlConvert.ToDouble((string)value);
2397if (sourceType == StringType) return Int32ToInt16(XmlConvert.ToInt32((string)value));
2401if (sourceType == StringType) return XmlConvert.ToInt32((string)value);
2405if (sourceType == StringType) return XmlConvert.ToInt64((string)value);
2409if (sourceType == StringType) return Int32ToSByte(XmlConvert.ToInt32((string)value));
2413if (sourceType == StringType) return XmlConvert.ToSingle((string)value);
2421if (sourceType == StringType) return Int32ToUInt16(XmlConvert.ToInt32((string)value));
2425if (sourceType == StringType) return Int64ToUInt32(XmlConvert.ToInt64((string)value));
2429if (sourceType == StringType) return DecimalToUInt64(XmlConvert.ToDecimal((string)value));
2433if (sourceType == StringType) return XmlConvert.ToUri((string)value);
3093return new List<string>(XmlConvert.SplitString(value));
System\Xml\Serialization\PrimitiveXmlSerializers.cs (30)
31WriteElementStringRaw(@"int", @"", System.Xml.XmlConvert.ToString((int)((int)o)));
42WriteElementStringRaw(@"boolean", @"", System.Xml.XmlConvert.ToString((bool)((bool)o)));
53WriteElementStringRaw(@"short", @"", System.Xml.XmlConvert.ToString((short)((short)o)));
64WriteElementStringRaw(@"long", @"", System.Xml.XmlConvert.ToString((long)((long)o)));
75WriteElementStringRaw(@"float", @"", System.Xml.XmlConvert.ToString((float)((float)o)));
86WriteElementStringRaw(@"double", @"", System.Xml.XmlConvert.ToString((double)((double)o)));
99WriteElementStringRaw(@"decimal", @"", System.Xml.XmlConvert.ToString(d));
122WriteElementStringRaw(@"dateTimeOffset", @"", System.Xml.XmlConvert.ToString(dto));
133WriteElementStringRaw(@"unsignedByte", @"", System.Xml.XmlConvert.ToString((byte)((byte)o)));
144WriteElementStringRaw(@"byte", @"", System.Xml.XmlConvert.ToString((sbyte)((sbyte)o)));
155WriteElementStringRaw(@"unsignedShort", @"", System.Xml.XmlConvert.ToString((ushort)((ushort)o)));
166WriteElementStringRaw(@"unsignedInt", @"", System.Xml.XmlConvert.ToString((uint)((uint)o)));
177WriteElementStringRaw(@"unsignedLong", @"", System.Xml.XmlConvert.ToString((ulong)((ulong)o)));
202WriteElementStringRaw(@"guid", @"", System.Xml.XmlConvert.ToString(guid));
214WriteElementStringRaw(@"TimeSpan", @"", System.Xml.XmlConvert.ToString(timeSpan));
286o = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString());
310o = System.Xml.XmlConvert.ToBoolean(Reader.ReadElementString());
334o = System.Xml.XmlConvert.ToInt16(Reader.ReadElementString());
358o = System.Xml.XmlConvert.ToInt64(Reader.ReadElementString());
382o = System.Xml.XmlConvert.ToSingle(Reader.ReadElementString());
406o = System.Xml.XmlConvert.ToDouble(Reader.ReadElementString());
430o = System.Xml.XmlConvert.ToDecimal(Reader.ReadElementString());
484o = System.Xml.XmlConvert.ToDateTimeOffset(Reader.ReadElementString());
508o = System.Xml.XmlConvert.ToByte(Reader.ReadElementString());
532o = System.Xml.XmlConvert.ToSByte(Reader.ReadElementString());
556o = System.Xml.XmlConvert.ToUInt16(Reader.ReadElementString());
580o = System.Xml.XmlConvert.ToUInt32(Reader.ReadElementString());
604o = System.Xml.XmlConvert.ToUInt64(Reader.ReadElementString());
657o = System.Xml.XmlConvert.ToGuid(Reader.ReadElementString());
687o = System.Xml.XmlConvert.ToTimeSpan(Reader.ReadElementString());
System\Xml\Serialization\ReflectionXmlSerializationReader.cs (17)
328if (root == null || XmlConvert.ToBoolean(root))
1194"Boolean" => XmlConvert.ToBoolean(value),
1195"Int32" => XmlConvert.ToInt32(value),
1196"Int16" => XmlConvert.ToInt16(value),
1197"Int64" => XmlConvert.ToInt64(value),
1198"Single" => XmlConvert.ToSingle(value),
1199"Double" => XmlConvert.ToDouble(value),
1200"Decimal" => XmlConvert.ToDecimal(value),
1201"Byte" => XmlConvert.ToByte(value),
1202"SByte" => XmlConvert.ToSByte(value),
1203"UInt16" => XmlConvert.ToUInt16(value),
1204"UInt32" => XmlConvert.ToUInt32(value),
1205"UInt64" => XmlConvert.ToUInt64(value),
1206"Guid" => XmlConvert.ToGuid(value),
1207"Char" => XmlConvert.ToChar(value),
1208"TimeSpan" => XmlConvert.ToTimeSpan(value),
1209"DateTimeOffset" => XmlConvert.ToDateTimeOffset(value),
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (16)
1157"Boolean" => XmlConvert.ToString((bool)o),
1158"Int32" => XmlConvert.ToString((int)o),
1159"Int16" => XmlConvert.ToString((short)o),
1160"Int64" => XmlConvert.ToString((long)o),
1161"Single" => XmlConvert.ToString((float)o),
1162"Double" => XmlConvert.ToString((double)o),
1163"Decimal" => XmlConvert.ToString((decimal)o),
1164"Byte" => XmlConvert.ToString((byte)o),
1165"SByte" => XmlConvert.ToString((sbyte)o),
1166"UInt16" => XmlConvert.ToString((ushort)o),
1167"UInt32" => XmlConvert.ToString((uint)o),
1168"UInt64" => XmlConvert.ToString((ulong)o),
1170"Guid" => XmlConvert.ToString((Guid)o),
1171"Char" => XmlConvert.ToString((char)o),
1172"TimeSpan" => XmlConvert.ToString((TimeSpan)o),
1173"DateTimeOffset" => XmlConvert.ToString((DateTimeOffset)o),
System\Xml\Serialization\SchemaObjectWriter.cs (18)
722WriteAttribute(@"fixed", @"", XmlConvert.ToString(o.IsFixed));
809WriteAttribute(@"abstract", @"", XmlConvert.ToString((bool)(bool)o.@IsAbstract));
814WriteAttribute(@"mixed", @"", XmlConvert.ToString((bool)(bool)o.@IsMixed));
907WriteAttribute(@"mixed", @"", XmlConvert.ToString((bool)((bool)o.@IsMixed)));
960WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
961WriteAttribute("maxOccurs", "", o.MaxOccurs == decimal.MaxValue ? "unbounded" : XmlConvert.ToString(o.MaxOccurs));
973WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
974WriteAttribute("maxOccurs", "", o.MaxOccurs == decimal.MaxValue ? "unbounded" : XmlConvert.ToString(o.MaxOccurs));
977WriteAttribute(@"abstract", @"", XmlConvert.ToString((bool)(bool)o.@IsAbstract));
1000WriteAttribute(@"nillable", @"", XmlConvert.ToString(o.IsNillable));
1135WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
1136WriteAttribute(@"maxOccurs", @"", o.MaxOccurs == decimal.MaxValue ? "unbounded" : XmlConvert.ToString(o.MaxOccurs));
1149WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
1150WriteAttribute(@"maxOccurs", @"", o.MaxOccurs == decimal.MaxValue ? "unbounded" : XmlConvert.ToString(o.MaxOccurs));
1165WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
1166WriteAttribute("maxOccurs", "", o.MaxOccurs == decimal.MaxValue ? "unbounded" : XmlConvert.ToString(o.MaxOccurs));
1206WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
1207WriteAttribute(@"maxOccurs", @"", o.MaxOccurs == decimal.MaxValue ? "unbounded" : XmlConvert.ToString(o.MaxOccurs));
System\Xml\Serialization\Xmlcustomformatter.cs (20)
80return XmlConvert.ToString(value, "yyyy-MM-dd");
87return XmlConvert.ToString(DateTime.MinValue + value.TimeOfDay, "HH:mm:ss.fffffffZ");
91return XmlConvert.ToString(DateTime.MinValue + value.TimeOfDay, "HH:mm:ss.fffffffzzzzzz");
99return XmlConvert.ToString(value, "yyyy-MM-ddTHH:mm:ss.fffffffzzzzzz");
104return XmlConvert.ToString(value, XmlDateTimeSerializationMode.RoundtripKind);
112return XmlConvert.TryFormat(value, "yyyy-MM-ddTHH:mm:ss.fffffffzzzzzz", destination, out charsWritten);
116return XmlConvert.TryFormat(value, XmlDateTimeSerializationMode.RoundtripKind, destination, out charsWritten);
121return XmlConvert.ToString((ushort)value);
127return XmlConvert.EncodeName(name);
133return XmlConvert.EncodeLocalName(ncName);
139return XmlConvert.EncodeNmToken(nmToken);
179return XmlConvert.ToBinHexString(value);
382return XmlConvert.ToDateTime(value, XmlDateTimeSerializationMode.RoundtripKind);
388return XmlConvert.ToDateTime(value, formats);
410return (char)XmlConvert.ToUInt16(value);
416return XmlConvert.DecodeName(CollapseWhitespace(value));
422return XmlConvert.DecodeName(CollapseWhitespace(value));
428return XmlConvert.DecodeName(CollapseWhitespace(value));
434return XmlConvert.DecodeName(CollapseWhitespace(value));
451return XmlConvert.FromBinHexString(value.AsSpan().Trim(), true);
System\Xml\Serialization\XmlSerializationWriter.cs (18)
277tryFormatResult = XmlConvert.TryFormat((int)o, _primitivesBuffer, out charsWritten);
281tryFormatResult = XmlConvert.TryFormat((bool)o, _primitivesBuffer, out charsWritten);
285tryFormatResult = XmlConvert.TryFormat((short)o, _primitivesBuffer, out charsWritten);
289tryFormatResult = XmlConvert.TryFormat((long)o, _primitivesBuffer, out charsWritten);
293tryFormatResult = XmlConvert.TryFormat((float)o, _primitivesBuffer, out charsWritten);
297tryFormatResult = XmlConvert.TryFormat((double)o, _primitivesBuffer, out charsWritten);
301tryFormatResult = XmlConvert.TryFormat((decimal)o, _primitivesBuffer, out charsWritten);
309tryFormatResult = XmlConvert.TryFormat((ushort)(char)o, _primitivesBuffer, out charsWritten);
314tryFormatResult = XmlConvert.TryFormat((byte)o, _primitivesBuffer, out charsWritten);
318tryFormatResult = XmlConvert.TryFormat((sbyte)o, _primitivesBuffer, out charsWritten);
322tryFormatResult = XmlConvert.TryFormat((ushort)o, _primitivesBuffer, out charsWritten);
326tryFormatResult = XmlConvert.TryFormat((uint)o, _primitivesBuffer, out charsWritten);
330tryFormatResult = XmlConvert.TryFormat((ulong)o, _primitivesBuffer, out charsWritten);
355tryFormatResult = XmlConvert.TryFormat((Guid)o, _primitivesBuffer, out charsWritten);
361tryFormatResult = XmlConvert.TryFormat((TimeSpan)o, _primitivesBuffer, out charsWritten);
367tryFormatResult = XmlConvert.TryFormat((DateTimeOffset)o, _primitivesBuffer, out charsWritten);
468return GetQualifiedName(EscapeName ? XmlConvert.EncodeLocalName(xmlQualifiedName.Name) : xmlQualifiedName.Name, xmlQualifiedName.Namespace);
2427Writer.Write(typeof(XmlConvert).FullName);