为什么 ISerializationSurrogate.SetObject 返回一个对象并获取一个对象来填充?
我最近在研究运行时序列化,并遇到了 ISerializationSurrogate
界面。我对它的 SetObject
方法但是。
签名为:
object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
帮助信息为:
摘要:
使用 System.Runtime.Serialization.SerializationInfo 中的信息填充对象。
参数:
obj:要填充的对象。
信息:填充对象的信息。
上下文:反序列化对象的源。
选择器:代理选择器,从这里开始搜索兼容的代理。
退货:
填充的反序列化对象。
如果 obj
是要填充的对象,为什么它会返回填充的反序列化对象
?在 MSDN 的一个示例中,它们填充obj
并返回 null
。
I was recently looking at Runtime Serialization and came across the ISerializationSurrogate
interface. I am confused about it's SetObject
method however.
The signature is:
object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
and the help information is:
Summary:
Populates the object using the information in the System.Runtime.Serialization.SerializationInfo.
Parameters:
obj: The object to populate.
info: The information to populate the object.
context: The source from which the object is deserialized.
selector: The surrogate selector where the search for a compatible surrogate begins.
Returns:
The populated deserialized object.
If obj
is the object to populate, why does it return The populated deserialized object
? In one example from MSDN they populate obj
and return null
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看此 .NET 专栏文章:http://msdn.microsoft.com/en- us/magazine/cc188950.aspx
它说:
Check this .NET column article: http://msdn.microsoft.com/en-us/magazine/cc188950.aspx
It says: