Serialiazing CollectionBase

V

Victor Irzak

Hello...
I the following class deriving from CollectionBase:

============================
public class YYYepC : System.Collections.CollectionBase
{
int i = 9;

[DefaultValue(4)]
[PersistenceMode(PersistenceMode.Attribute)]
public int I
{
get {return i;}
set {i=value;
}
}
}
============================

When I try to serialize it in my web control, the "I" property doesn't get
serialized. Only the sollection items get serialized.

Here is my control:
============================
public class WebChartingControl : System.Web.UI.WebControls.WebControl
{

YYYepC da2 = new YYYepC();

[PersistenceMode(PersistenceMode.InnerProperty)]
[NotifyParentProperty(true)]
public YYYepC YYYepC
{
get {return da2;}
set {da2 = value;}
}
}
============================


How can I serialize all the other properties?

Thanks,

Victor
 
F

Fred Hirschfeld

I don't think I can answer your question but might be able to point you in
the right direction... Collections are intended to be serialized as items to
the Control when used this way. I use them to serialize inner tags to be
used by the control like the DataGrid uses Columns.

I think you are going to need to create a custom designer to process the
collection class so it does the properties of the collection instead of the
items of the collection. Take a look into DesignerSerializerAttribute class
to see if there are examples for it out there...

Fred
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top