Hi. I have a class A with an attribute of type B that has an attribute that
is a collection of type C. In B, the attribute that is a collection of C is
marked with the NonSerialized attribute and in A, the attribute that is of
type B is also marked with the NonSerialized attribute.
class A
{
[NonSerialized]
B b;
}
class B
{
[NonSerialized]
C c;
}
class C : IEnumerable
{
...
public void Add(object o) {}
}
I save an object of type A with the Configuration Application Block of
Enterprise Library, which tries to serialize the object. And there comes the
error. The message says that the collection of type C should have an method
Add because it inherits from IEnumerable.
The collection has the method Add and should not be serialized once it is
marked with NonSerialized attribute.
If anyone can understand the problem, can you help me?