[Mono-list] Xml Deserialize + Constructor Needed

Pablo Fischer pablo@pablo.com.mx
Tue, 14 Oct 2003 11:25:02 -0500


Thanks! It works!

Also thanks to Rafael.

Pablo
El mar, 14-10-2003 a las 03:28, Lluis Sanchez escribió:
> On dt, 2003-10-14 at 06:58, Pablo Fischer wrote:
> > Hi all!
> > 
> > I created a file in XML with the help of XmlSerialization, how I want to
> > Deserialize it, I found in may sites (also in msdn) a simple way to do
> > this, so my method:
> > 
> > private static void Desarmar() {
> >  Accounts accs = new Accounts("test");
> >  XmlSerialize mySerializer = new XmlSerializer(typeof(Accounts));
> >  FileStream myFileStream = new FileStream(".mbloggyrc", FileMode.Open);
> >  accs = (Accounts)mySerializer.Deserialize(myFileStream);
> > }
> > 
> > It compiles ok, but when I run it I get:
> > 
> > Unhandled Exception: System.MissingMethodException: Default constructor
> > not found
> > (snip)
> > in <0x0009a> .testing:Desarmar ()
> > in <0x0012c> .testing:Main ()
> > 
> > A Default Constructor.. for what? I have a Constructor for each
> > element..
> 
> A default constructor for Accounts. XmlSerializer will create the
> Accounts instance for you, you don't need to create it yourself.
> 
> Lluis.
> 
> > 
> > Thanks!
> > Pablo
>