<(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed)...
|I have this method in class Foo:
|
| public Foo DeserializeXML(string sXML)
| {
| XmlSerializer serializer = new XmlSerializer(typeof(Foo));
| StringReader sr = new StringReader(sXML);
| return (Foo)serializer.Deserialize(sr);
|
| }
|
| which seems to work fine if I do this:
| Foo myFoo = new Foo();
| myFoo = myFoo.Deserialize(myXMLString);
|
| I'm trying to figure out if there's a simple way to do the
| deserialization in a constructor.
public class Foo
{
// private fields
public Foo(string sXML) : base ()
{
Deserialize(sXML);
}
private void DeserializeXML(string sXML)
{
// assign decoded XML to private fields
}
}
{
Foo myFoo = new Foo(myXMLString);
...
}
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer