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


C# XmlReaderDelegator.Read方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: ReadJsonValueCore

 public override object ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
 {
     jsonReader.Read();
     object obj2 = null;
     if (context.IsGetOnlyCollection)
     {
         context.IsGetOnlyCollection = false;
         this.JsonFormatGetOnlyReaderDelegate(jsonReader, context, XmlDictionaryString.Empty, JsonGlobals.itemDictionaryString, this.TraditionalCollectionDataContract);
     }
     else
     {
         obj2 = this.JsonFormatReaderDelegate(jsonReader, context, XmlDictionaryString.Empty, JsonGlobals.itemDictionaryString, this.TraditionalCollectionDataContract);
     }
     jsonReader.ReadEndElement();
     return obj2;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:16,代碼來源:JsonCollectionDataContract.cs

示例5: ReadXmlValue

 public override object ReadXmlValue(XmlReaderDelegator reader, XmlObjectSerializerReadContext context)
 {
     object obj;
     if (reader.IsEmptyElement)
     {
         reader.Skip();
         obj = new object();
     }
     else
     {
         string localName = reader.LocalName;
         string ns = reader.NamespaceURI;
         reader.Read();
         try
         {
             reader.ReadEndElement();
             obj = new object();
         }
         catch (XmlException xes)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.Format(SR.XmlForObjectCannotHaveContent, localName, ns), xes));
         }
     }
     return (context == null) ? obj : HandleReadValue(obj, context);
 }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:25,代碼來源:PrimitiveDataContract.cs


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