本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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);
}