本文整理汇总了C#中System.Runtime.Serialization.XmlReaderDelegator.ReadContentAsString方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReaderDelegator.ReadContentAsString方法的具体用法?C# XmlReaderDelegator.ReadContentAsString怎么用?C# XmlReaderDelegator.ReadContentAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Runtime.Serialization.XmlReaderDelegator
的用法示例。
在下文中一共展示了XmlReaderDelegator.ReadContentAsString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadRef
private void ReadRef(XmlReaderDelegator reader)
{
Ref = reader.ReadContentAsString();
if (string.IsNullOrEmpty(Ref))
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.Format(SR.InvalidXsRefDefinition, Ref)));
}
}
示例2: ReadNumericalPrimitiveExtensionDataValue
private IDataNode ReadNumericalPrimitiveExtensionDataValue(XmlReaderDelegator xmlReader)
{
TypeCode type;
object numericalValue = JsonObjectDataContract.ParseJsonNumber(xmlReader.ReadContentAsString(), out type);
switch (type)
{
case TypeCode.Byte:
return new DataNode<byte>((byte)numericalValue);
case TypeCode.SByte:
return new DataNode<sbyte>((sbyte)numericalValue);
case TypeCode.Int16:
return new DataNode<short>((short)numericalValue);
case TypeCode.Int32:
return new DataNode<int>((int)numericalValue);
case TypeCode.Int64:
return new DataNode<long>((long)numericalValue);
case TypeCode.UInt16:
return new DataNode<ushort>((ushort)numericalValue);
case TypeCode.UInt32:
return new DataNode<uint>((uint)numericalValue);
case TypeCode.UInt64:
return new DataNode<ulong>((ulong)numericalValue);
case TypeCode.Single:
return new DataNode<float>((float)numericalValue);
case TypeCode.Double:
return new DataNode<double>((double)numericalValue);
case TypeCode.Decimal:
return new DataNode<decimal>((decimal)numericalValue);
default:
throw new InvalidOperationException(SR.ParseJsonNumberReturnInvalidNumber);
}
}
示例3: ReadId
void ReadId(XmlReaderDelegator reader)
{
Id = reader.ReadContentAsString();
if (string.IsNullOrEmpty(Id))
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.InvalidXsIdDefinition, Id)));
}
}
示例4: ReadPrimitiveExtensionDataValue
protected override IDataNode ReadPrimitiveExtensionDataValue(XmlReaderDelegator xmlReader, string dataContractName, string dataContractNamespace)
{
IDataNode dataNode;
switch (_extensionDataValueType)
{
case null:
case JsonGlobals.stringString:
dataNode = new DataNode<string>(xmlReader.ReadContentAsString());
break;
case JsonGlobals.booleanString:
dataNode = new DataNode<bool>(xmlReader.ReadContentAsBoolean());
break;
case JsonGlobals.numberString:
dataNode = ReadNumericalPrimitiveExtensionDataValue(xmlReader);
break;
default:
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
XmlObjectSerializer.CreateSerializationException(SR.Format(SR.JsonUnexpectedAttributeValue, _extensionDataValueType)));
}
xmlReader.ReadEndElement();
return dataNode;
}
示例5: ReadRef
private void ReadRef(XmlReaderDelegator reader)
{
this.Ref = reader.ReadContentAsString();
if (string.IsNullOrEmpty(this.Ref))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(System.Runtime.Serialization.SR.GetString("InvalidXsRefDefinition", new object[] { this.Ref })));
}
}