當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。