Is there a way to invoke to a custom action when an xml is
deserialized to an object based on the value in the Xml?
For example, I have
public class Book
{
public string author;
public string name;
public Book()
{
}
public void changeName()
{
if (author == "XXXXX")
author = "Change me";
}
}
and an xml:
<?xml version="1.0" encoding="utf-8" ?>
<Book>
<author>XXXXX </author>
<name>SomeNam e</name>
</Book>
Based on the value in node <author>, I want to change it to something
else by invoking the changeName() method above. I want to do it while
the xml is being deserialized to an instance.
Is it possible? If so how?
Thanks
-Neeraj
deserialized to an object based on the value in the Xml?
For example, I have
public class Book
{
public string author;
public string name;
public Book()
{
}
public void changeName()
{
if (author == "XXXXX")
author = "Change me";
}
}
and an xml:
<?xml version="1.0" encoding="utf-8" ?>
<Book>
<author>XXXXX </author>
<name>SomeNam e</name>
</Book>
Based on the value in node <author>, I want to change it to something
else by invoking the changeName() method above. I want to do it while
the xml is being deserialized to an instance.
Is it possible? If so how?
Thanks
-Neeraj