Serialize Objects using xmlSerializer.Serialize and IEnumerable objects

后端 未结 2 1048
名媛妹妹
名媛妹妹 2021-01-04 08:20

I have an object that holds an object that is definded as IEnumerable, i.e.

[Serializable]
[XmlRoot(\"MyObject\")]
public class MyObject
{
    [XmlAttribute]         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-01-04 08:57

    If you don't mind the list being editable i.e. Adding/Removing publically then List<> would be fine. Otherwise, you should use ReadOnlyCollection

提交回复
热议问题