I have manage to solve the problem in following way:
Code:
[Serializable]
public class Location
{
private IList subLocations = new ArrayList();
[XmlIgnore]
protected virtual IList SubLocations
{
get { return subLocations; }
set { subLocations = value; }
}
public virtual List<SubLocation> SubLocationCollection
{
get { return GetSubLocations(); }
}
public virtual List<SubLocation> GetSubLocations()
{
SubLocation[] locs = null;
if (SubLocations.Count > 0)
{
locs = new SubLocation[SubLocations.Count];
SubLocations.CopyTo(locs, 0);
}
return (new List<SubLocation>(locs));
}
}
Obviously, you can always make it neater