當前位置: 首頁>>代碼示例>>C#>>正文


C# Serialization.XmlReaderDelegator類代碼示例

本文整理匯總了C#中System.Runtime.Serialization.XmlReaderDelegator的典型用法代碼示例。如果您正苦於以下問題:C# XmlReaderDelegator類的具體用法?C# XmlReaderDelegator怎麽用?C# XmlReaderDelegator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XmlReaderDelegator類屬於System.Runtime.Serialization命名空間,在下文中一共展示了XmlReaderDelegator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ReadXmlValue

 public override object ReadXmlValue(XmlReaderDelegator reader, XmlObjectSerializerReadContext context)
 {
     object obj2;
     if (reader.IsEmptyElement)
     {
         reader.Skip();
         obj2 = new object();
     }
     else
     {
         string localName = reader.LocalName;
         string namespaceURI = reader.NamespaceURI;
         reader.Read();
         try
         {
             reader.ReadEndElement();
             obj2 = new object();
         }
         catch (XmlException exception)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(System.Runtime.Serialization.SR.GetString("XmlForObjectCannotHaveContent", new object[] { localName, namespaceURI }), exception));
         }
     }
     if (context != null)
     {
         return base.HandleReadValue(obj2, context);
     }
     return obj2;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:29,代碼來源:ObjectDataContract.cs

示例2: ReflectionInitArgs

 private void ReflectionInitArgs(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, XmlDictionaryString[] memberNames, XmlDictionaryString[] memberNamespaces)
 {
     _arg0XmlReader = xmlReader;
     _arg1Context = context;
     _arg2MemberNames = memberNames;
     _arg3MemberNamespaces = memberNamespaces;
 }
開發者ID:SGuyGe,項目名稱:corefx,代碼行數:7,代碼來源:ReflectionXmlFormatReader.cs

示例3: ReadXmlValue

 public override object ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
 {
     xmlReader.Read();
     Type underlyingType = base.UnderlyingType;
     object obj2 = underlyingType.IsArray ? Array.CreateInstance(underlyingType.GetElementType(), 0) : this.GetUninitializedObject(underlyingType);
     context.AddNewObject(obj2);
     string objectId = context.GetObjectId();
     SerializationInfo serInfo = context.ReadSerializationInfo(xmlReader, underlyingType);
     object newObj = this.SerializationSurrogateSetObjectData(obj2, serInfo, context.GetStreamingContext());
     if (newObj == null)
     {
         newObj = obj2;
     }
     if (newObj is IDeserializationCallback)
     {
         ((IDeserializationCallback) newObj).OnDeserialization(null);
     }
     if (newObj is IObjectReference)
     {
         newObj = GetRealObject((IObjectReference) newObj, context.GetStreamingContext());
     }
     context.ReplaceDeserializedObject(objectId, obj2, newObj);
     xmlReader.ReadEndElement();
     return newObj;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:25,代碼來源:SurrogateDataContract.cs

示例4: GetJsonMemberIndex

 public int GetJsonMemberIndex(XmlReaderDelegator xmlReader, XmlDictionaryString[] memberNames, int memberIndex, ExtensionDataObject extensionData)
 {
     int length = memberNames.Length;
     if (length != 0)
     {
         for (int i = 0, index = (memberIndex + 1) % length; i < length; i++, index = (index + 1) % length)
         {
             if (xmlReader.IsStartElement(memberNames[index], XmlDictionaryString.Empty))
             {
                 return index;
             }
         }
         string name;
         if (TryGetJsonLocalName(xmlReader, out name))
         {
             for (int i = 0, index = (memberIndex + 1) % length; i < length; i++, index = (index + 1) % length)
             {
                 if (memberNames[index].Value == name)
                 {
                     return index;
                 }
             }
         }
     }
     HandleMemberNotFound(xmlReader, extensionData, memberIndex);
     return length;
 }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:27,代碼來源:XmlObjectSerializerReadContextComplexJson.cs

示例5: ReadJsonValue

 public object ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
 {
     PushKnownDataContracts(context);
     object deserializedObject = ReadJsonValueCore(jsonReader, context);
     PopKnownDataContracts(context);
     return deserializedObject;
 }
開發者ID:johnhhm,項目名稱:corefx,代碼行數:7,代碼來源:JsonDataContract.cs

示例6: ReadJsonValue

 public object ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
 {
     this.PushKnownDataContracts(context);
     object obj2 = this.ReadJsonValueCore(jsonReader, context);
     this.PopKnownDataContracts(context);
     return obj2;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:7,代碼來源:JsonDataContract.cs

示例7: ReadJsonValueCore

 public override object ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
 {
     jsonReader.Read();
     object obj2 = this.JsonFormatReaderDelegate(jsonReader, context, XmlDictionaryString.Empty, this.MemberNames);
     jsonReader.ReadEndElement();
     return obj2;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:7,代碼來源:JsonClassDataContract.cs

示例8: ReflectionReadMembers

 private void ReflectionReadMembers(object obj, XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, XmlDictionaryString[] memberNames, XmlDictionaryString[] memberNamespaces)
 {
     int memberCount = _classContract.MemberNames.Length;
     context.IncrementItemCount(memberCount);
     int memberIndex = -1;
     int firstRequiredMember;
     bool[] requiredMembers = GetRequiredMembers(_classContract, out firstRequiredMember);
     bool hasRequiredMembers = (firstRequiredMember < memberCount);
     int requiredIndex = hasRequiredMembers ? firstRequiredMember : -1;
     int index = -1;
     while (true)
     {
         if (!XmlObjectSerializerReadContext.MoveToNextElement(xmlReader))
         {
             return;
         }
         if (hasRequiredMembers)
         {
             index = context.GetMemberIndexWithRequiredMembers(xmlReader, memberNames, memberNamespaces, memberIndex, requiredIndex, null);
         }
         else
         {
             index = context.GetMemberIndex(xmlReader, memberNames, memberNamespaces, memberIndex, null);
         }
         ReflectionReadMember(obj, index, xmlReader, context, memberNames, memberNamespaces);
         memberIndex = index;
         requiredIndex = index + 1;
     }
 }
開發者ID:SGuyGe,項目名稱:corefx,代碼行數:29,代碼來源:ReflectionXmlFormatReader.cs

示例9: ReadXmlValue

 public override object ReadXmlValue(XmlReaderDelegator reader, XmlObjectSerializerReadContext context)
 {
     if (context != null)
     {
         return base.HandleReadValue(reader.ReadElementContentAsChar(), context);
     }
     return reader.ReadElementContentAsChar();
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:8,代碼來源:CharDataContract.cs

示例10: Read

 internal void Read(XmlReaderDelegator reader)
 {
     this.Reset();
     while (reader.MoveToNextAttribute())
     {
         switch (reader.IndexOfLocalName(serializationLocalNames, DictionaryGlobals.SerializationNamespace))
         {
             case 0:
             {
                 this.ReadId(reader);
                 continue;
             }
             case 1:
             {
                 this.ReadArraySize(reader);
                 continue;
             }
             case 2:
             {
                 this.ReadRef(reader);
                 continue;
             }
             case 3:
             {
                 this.ClrType = reader.Value;
                 continue;
             }
             case 4:
             {
                 this.ClrAssembly = reader.Value;
                 continue;
             }
             case 5:
             {
                 this.ReadFactoryType(reader);
                 continue;
             }
         }
         switch (reader.IndexOfLocalName(schemaInstanceLocalNames, DictionaryGlobals.SchemaInstanceNamespace))
         {
             case 0:
             {
                 this.ReadXsiNil(reader);
                 continue;
             }
             case 1:
             {
                 this.ReadXsiType(reader);
                 continue;
             }
         }
         if (!reader.IsNamespaceUri(DictionaryGlobals.XmlnsNamespace))
         {
             this.UnrecognizedAttributesFound = true;
         }
     }
     reader.MoveToElement();
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:58,代碼來源:Attributes.cs

示例11: BeginRead

 internal void BeginRead(XmlReaderDelegator xmlReader)
 {
     if (xmlReader.NodeType != XmlNodeType.Element)
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializerReadContext.CreateUnexpectedStateException(XmlNodeType.Element, xmlReader));
     _xmlReader = xmlReader;
     _startDepth = xmlReader.Depth;
     _innerReader = xmlReader.UnderlyingReader;
     _isRootEmptyElement = InnerReader.IsEmptyElement;
 }
開發者ID:ChuangYang,項目名稱:corefx,代碼行數:9,代碼來源:XmlSerializableReader.cs

示例12: TryReadNullAtTopLevel

 protected static bool TryReadNullAtTopLevel(XmlReaderDelegator reader)
 {
     while (reader.MoveToAttribute("type") && (reader.Value == "null"))
     {
         reader.Skip();
         reader.MoveToElement();
         return true;
     }
     reader.MoveToElement();
     return false;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:11,代碼來源:JsonDataContract.cs

示例13: ReadXmlValue

 public override object ReadXmlValue(XmlReaderDelegator reader, XmlObjectSerializerReadContext context)
 {
     if (context != null)
     {
         return base.HandleReadValue(reader.ReadElementContentAsQName(), context);
     }
     if (!base.TryReadNullAtTopLevel(reader))
     {
         return reader.ReadElementContentAsQName();
     }
     return null;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:12,代碼來源:QNameDataContract.cs

示例14: ReadJsonValueCore

 public override object ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
 {
     if (context != null)
     {
         return JsonDataContract.HandleReadValue(jsonReader.ReadElementContentAsBase64(), context);
     }
     if (!JsonDataContract.TryReadNullAtTopLevel(jsonReader))
     {
         return jsonReader.ReadElementContentAsBase64();
     }
     return null;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:12,代碼來源:JsonByteArrayDataContract.cs

示例15: InternalDeserialize

 internal override object InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, string name, string ns)
 {
     if (_mode == SerializationMode.SharedContract)
     {
         if (_serializationSurrogateProvider == null)
             return base.InternalDeserialize(xmlReader, declaredType, name, ns);
         else
             return InternalDeserializeWithSurrogate(xmlReader, declaredType, null /*surrogateDataContract*/, name, ns);
     }
     else
     {
         return InternalDeserializeInSharedTypeMode(xmlReader, -1, declaredType, name, ns);
     }
 }
開發者ID:nadyalo,項目名稱:corefx,代碼行數:14,代碼來源:XmlObjectSerializerReadContextComplex.cs


注:本文中的System.Runtime.Serialization.XmlReaderDelegator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。