views:

11

answers:

0

Hi All,

I'm trying to serialize a class using XmlSerializer. This class contains a member of a type which implements IEnumerable. Here is a snippet of the code:

[Serializable] public class A{ private A1 m1; privte A2 m2; }

[Serializable] public class A1: IEnumerable{ private List _list; }

[Serializable] public class A2{ ... }

[Serializable] public class A3{ ... }

In the line: XmlSerializer ser = new XmlSerializer(typeof(A)) I get the exeception: "To be XML serializable, types which inherit from IEnumerable ... should implement method Add(System.Object)". I implemented that method in class A1.

What am I missing?

Thanks in advance! Sorry for the long post.