更新时间:2023-09-09 11:29:46
添加这样的属性来保存组件列表:
Add a property like this to hold the list of Components:
[XmlArray()]
public List<Component> Components { get; set; }
抱歉我误读了.您想将其读入字符串集合.我只是在下面试过这个,它对你的样本有效.关键只是设置正确的xml序列化属性.
Sorry I misread that. You want to read it into a collection of strings. I just tried this below and it worked on your sample. The key is just to setup the correct xml serialization attributes.
public class ArsAction
{
[XmlArray]
[XmlArrayItem(ElementName="Component")]
public List<string> Components { get; set; }
}