зеркало из https://github.com/mono/mail-archives.git
101 строка
3.6 KiB
HTML
101 строка
3.6 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-list] Xml Deserialize + Constructor Needed
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:pablo%40pablo.com.mx">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
|
|
<LINK REL="Previous" HREF="016444.html">
|
|
<LINK REL="Next" HREF="016387.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-list] Xml Deserialize + Constructor Needed
|
|
</H1>
|
|
<B>Pablo Fischer
|
|
</B>
|
|
<A HREF="mailto:pablo%40pablo.com.mx"
|
|
TITLE="[Mono-list] Xml Deserialize + Constructor Needed">pablo@pablo.com.mx
|
|
</A><BR>
|
|
<I>Mon, 13 Oct 2003 23:58:22 -0500</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="016444.html">[Mono-list] Building fron CVS
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016387.html">[Mono-list] Xml Deserialize + Constructor Needed
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16381">[ date ]</a>
|
|
<a href="thread.html#16381">[ thread ]</a>
|
|
<a href="subject.html#16381">[ subject ]</a>
|
|
<a href="author.html#16381">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>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
|
|
in <0x00144> System.Activator:CreateInstance (System.Type,bool)
|
|
in <0x00012> System.Activator:CreateInstance (System.Type)
|
|
in <0x001ab>
|
|
System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadClassInstance (System.Xml.Serialization.XmlTypeMapping,bool,bool)
|
|
in <0x00067>
|
|
System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadObject
|
|
(System.Xml.Serialization.XmlTypeMapping,bool,bool)
|
|
in <0x000a2>
|
|
System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadObject ()
|
|
in <0x00075> System.Xml.Serialization.XmlSerializer:Deserialize
|
|
(System.Xml.Serialization.XmlSerializationReader)
|
|
in <0x00068> System.Xml.Serialization.XmlSerializer:Deserialize
|
|
(System.Xml.XmlReader)
|
|
in <0x0003f> System.Xml.Serialization.XmlSerializer:Deserialize
|
|
(System.IO.Stream)
|
|
in <0x0009a> .testing:Desarmar ()
|
|
in <0x0012c> .testing:Main ()
|
|
|
|
A Default Constructor.. for what? I have a Constructor for each
|
|
element..
|
|
|
|
Thanks!
|
|
Pablo
|
|
--
|
|
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
|
|
<A HREF="http://www.pablo.com.mx">http://www.pablo.com.mx</A>
|
|
<A HREF="http://www.debianmexico.org">http://www.debianmexico.org</A>
|
|
GPG FingerTip: 3D49 4CB8 8951 F2CA 8131 AF7C D1B9 1FB9 6B11 810C
|
|
Firma URL: <A HREF="http://www.pablo.com.mx/firmagpg.txt">http://www.pablo.com.mx/firmagpg.txt</A>
|
|
|
|
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="016444.html">[Mono-list] Building fron CVS
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016387.html">[Mono-list] Xml Deserialize + Constructor Needed
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16381">[ date ]</a>
|
|
<a href="thread.html#16381">[ thread ]</a>
|
|
<a href="subject.html#16381">[ subject ]</a>
|
|
<a href="author.html#16381">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|