当前位置: 首页>>代码示例>>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;未经允许,请勿转载。