Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ReadContentAs()

virtual object System.Xml.XmlReader.ReadContentAs ( Type returnType,
IXmlNamespaceResolver? namespaceResolver )
inlinevirtualinherited

Reimplemented in System.Xml.XmlDictionaryReader.

Definition at line 295 of file XmlReader.cs.

296 {
297 if (!CanReadContentAs())
298 {
299 throw CreateReadContentAsException("ReadContentAs");
300 }
302 if (returnType == typeof(string))
303 {
304 return text;
305 }
306 try
307 {
308 return XmlUntypedStringConverter.Instance.FromString(text, returnType, namespaceResolver ?? (this as IXmlNamespaceResolver));
309 }
310 catch (FormatException innerException)
311 {
312 throw new XmlException(System.SR.Xml_ReadContentAsFormatException, returnType.ToString(), innerException, this as IXmlLineInfo);
313 }
314 catch (InvalidCastException innerException2)
315 {
316 throw new XmlException(System.SR.Xml_ReadContentAsFormatException, returnType.ToString(), innerException2, this as IXmlLineInfo);
317 }
318 }
static string Xml_ReadContentAsFormatException
Definition SR.cs:190
Definition SR.cs:7
Exception CreateReadContentAsException(string methodName)
string InternalReadContentAsString()

References System.Xml.XmlReader.CanReadContentAs(), System.Xml.XmlReader.CreateReadContentAsException(), System.Xml.Dictionary, System.Xml.Schema.XmlUntypedStringConverter.Instance, System.Xml.XmlReader.InternalReadContentAsString(), System.text, System.SR.Xml_ReadContentAsFormatException, and System.Xml.XmlException.

Referenced by System.Runtime.Serialization.XmlSerializableReader.ReadContentAs(), System.Xml.XmlAsyncCheckReader.ReadContentAs(), System.Xml.XmlSubtreeReader.ReadContentAs(), System.Xml.XmlDictionaryReader.XmlWrappedReader.ReadContentAs(), System.Xml.XmlDictionaryReader.XmlWrappedReader.ReadContentAsDecimal(), and System.Xml.XmlReader.ReadElementContentAs().