【发布时间】:2013-06-20 14:11:01
【问题描述】:
我开始在.NET 框架中了解serialization,但无法找到您应该为返回自定义集合或自定义类对象的属性做什么。在下面的示例中,我的 Items 属性返回自定义集合。我是否还需要向该类添加“datacontract”属性?
如果任何属性返回自定义类类型,还要稍微改变它,那么您必须用datacontract 标记所有这些类(如果它们有属性,则标记为datamember)?
<DataContract()> Public NotInheritable Class MyMainClass
Private pFilters As MyCustomClass
<DataMember()> Public ReadOnly Property Items As MyCustomCollection
Get
Return pFilters
End Get
End Property
Public Class MyCustomCollection
'Stuff in here
End Class
End Class
【问题讨论】:
标签: .net vb.net serialization