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


C# XmlReaderDelegator.ReadContentAsString方法代码示例

本文整理汇总了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)));
     }
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:8,代码来源:Attributes.cs

示例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);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:32,代码来源:XmlObjectSerializerReadContextComplexJson.cs

示例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)));
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:Attributes.cs

示例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;
        }
开发者ID:dotnet,项目名称:corefx,代码行数:24,代码来源:XmlObjectSerializerReadContextComplexJson.cs

示例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 })));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:Attributes.cs


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