serialize a collection

M

Martin

how to serialize a collection in my custom object? i marked my typed
collection as Serializable. the objects in the collection have an own
TypeConverter. do i have to write a type converter for my list (which
inherits from List<>) too?

do i have to implement ISupportInitialize in my object which holds the
collection?
 
J

Jay Douglas

Martin,

All I've been doing to serialize collections are:

[Serializable()]
public class MyCollection : List<MyObject>
{

}

[Serializable()]
public class MyObject
{
private int testInt;
public int TestInt
{
get {return testInt;}
set {testInt = value;}
}
}
 
M

Martin

what I want is that the designer generates the code in order to add new
elements to my collection with Add(). Because of that I written a type
converter for my specific class. so the designer is able to create new
instances of my object. but what i want to know, how to get the designer
calling the Add() method in designer code.


Jay Douglas said:
Martin,

All I've been doing to serialize collections are:

[Serializable()]
public class MyCollection : List<MyObject>
{

}

[Serializable()]
public class MyObject
{
private int testInt;
public int TestInt
{
get {return testInt;}
set {testInt = value;}
}
}



Martin said:
how to serialize a collection in my custom object? i marked my typed
collection as Serializable. the objects in the collection have an own
TypeConverter. do i have to write a type converter for my list (which
inherits from List<>) too?

do i have to implement ISupportInitialize in my object which holds the
collection?
 

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

Top