vb System.Runtime.Serialization.IDataContractSurrogate.GetDeserializedObject类(方法)实例源码

下面列出了vb System.Runtime.Serialization.IDataContractSurrogate.GetDeserializedObject 类(方法)源码代码实例,从而了解它的用法。

作者:VB.NET开发    项目:System.Runtime.Serializatio   
Public Function GetDeserializedObject(ByVal obj As Object, _
    ByVal targetType As Type) As Object Implements _
    IDataContractSurrogate.GetDeserializedObject
    Console.WriteLine("GetDeserializedObject invoked")
    ' This method is called on deserialization.
    ' If PersonSurrogated is being deserialized...
    If TypeOf obj Is PersonSurrogated Then
        Console.WriteLine(vbTab & "returning PersonSurrogated")
        '... use the XmlSerializer to do the actual deserialization.
        Dim ps As PersonSurrogated = CType(obj, PersonSurrogated)
        Dim xs As New XmlSerializer(GetType(Person))
        Return CType(xs.Deserialize(New StringReader(ps.xmlData)), Person)
    End If
    Return obj

End Function


问题


面经


文章

微信
公众号

扫码关注公众号