I think I did that by passing in an array of types (all the custom types used in the object to be serialized) to the serialize method.
-----Original Message----- From: Jeff Knutson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 2:57 PM To: [EMAIL PROTECTED] Subject: [DOTNET] Serializing collectionbase into xml Hi Could someone please help me figure out how to do xml serialization of a custom collection derived from CollectionBase? I have gotten this to work for ArrayList, but would much rather have my own custom collection. e.g. [XmlRoot( "Foo", Namespace="http://www.foo.com", IsNullable = false) ] class Foo { private Foobars foobars = new Foobars(); [XmlArrayItem( ElementName="Foobar", Type=typeof(Foobar) )] public Foobars Foobars { get{ return this.foobars; } } } class Foobars : CollectionBase {} [XmlRoot( "Foobar", Namespace="http://www.foo.com", ElementName="Foobar", IsNulllable = false) ] class Foobar { public int i; public short s; } When try to create an instance of the XmlSerializer, i am getting an InvalidOperationException : There was an error reflecting Foo. Here is the code for that: XmlSerializer s = new XmlSerializer( typeof( Foo ) ); Thanks in advance for the help. :) Jeff You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.