Unmoderated, If you want to skip them you can use [NonSerializable], but I suspect you want to programatically figure it out. In that case, you'll need to implement IXmlSerializable.
Thanks, Shawn Wildermuth http://adoguy.com C# MVP, MCSD.NET, Author and Speaker ->-----Original Message----- ->From: Unmoderated discussion of advanced .NET topics. ->[mailto:[EMAIL PROTECTED] On Behalf Of Eduard Lascu ->Sent: Wednesday, July 06, 2005 1:59 PM ->To: [email protected] ->Subject: [ADVANCED-DOTNET] Skipping data members in XML serialization -> ->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 DevelopMentorR http://www.develop.com -> ->View archives and manage your subscription(s) at ->http://discuss.develop.com 07/06/2005 03:03:23 PM =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
