简体   繁体   中英

c# xml serialization : ignore a class

I am using sgen.exe to generate a serializer for the classes of my project. Many classes have to be serizalized, and many others don't.

The attribute [XmlIgnore] doesn't works on classes, so is there a way to do it?

thanks

The only way I can think of is adding the XmlIgnore attribute to each property you do not want serialised. Not sure if sgen allows you to specify classes to ignore but I was having a look at this .

Hope that helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM