Hello experts,
Here is another interesting question. I have a simple class that is defined
like this:
public class BusinessCard
{
public string FirstName;
public string LastName;
public string Address;
}
when I am XML-serializing this I get something such as:
<BusinessCard>
<FirstName>Lance</FirstName>
<LastName>Armstrong</LastName>
<Address>Tour de France</Address>
</BusinessCard>
What I want is to programmatically skip some of the fields when I
XML-serialize a business card. For example, when serializing 100 business
card, based on some internal conditions, I want to skip the Address field
for some of them. I know that the XmlIgnore attribute can be used to ignore
the serialization of some of the members, but how do I set it
programmatically - the examples I've seen so far would set that attribute
for the data member at the class definition level, which means that the
field would be skipped always. That's not what I want. I want to be able to
decide for case to case, whether to skip the field or not.
Any suggestion will be appreciated.
Regards,
Eddie
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com