All,
1. Did anybody write Serialization/Deserialization of some custom class
derived
from the CollectionBase class? The custom class is like a container of many
different simple classes, each one of them is serializable, these methods
have been added and work properly.
As an additional headache this custom class can also include a few object
like collection classes.
What is the better way to get this CollectionClass serialized into XML
string and then restore it from the XML string if required? To serialize all
embedded objects one by one, return string and use this string to serialize
the object at the higher level?
This class implements Add(), Remove(), IndexOf(), Append() and other
methods.
--------------------------------------------------------------------------------------------------------------
2. The second question is:
The class has many private or protected members, almost each one has a
public property. Can we exclude some of these public properties from
serialization? I tried to add
[NonSerialized], but the VS writes the following:
Applications\CPhones.cs(396): Attribute 'NonSerialized' is not valid on this
declaration type. It is valid on 'field' declarations only.
All I tried to do was to add [NonSerialized] before public property.
private Int64 m_iOwnerID = -1;
[NonSerialized]
public int OwnerType
{
get
{
return m_iOwnerType;
}
set
{
m_iOwnerType = value;
}
} // End OwnerType Property
Just D.