|
-
Jan 17th, 2008, 07:05 PM
#1
[2.0] XML serialization, how do i force the empty fields to be serialized?
Hi!
i suppose this is a simple question if someone is familiar with xml serialization.
I'm serializing a class which only consists of some string fields. I want to make sure that all the fields are written to the XML file, even if they are uninitialized empty strings. Is there any way to tell the xml serializer class to enforce this?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jan 18th, 2008, 09:34 AM
#2
Re: [2.0] XML serialization, how do i force the empty fields to be serialized?
Add the attribute...
Code:
[XmlElement(IsNullable=true)]
to the fields you want serialized even when null.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jan 18th, 2008, 02:18 PM
#3
Re: [2.0] XML serialization, how do i force the empty fields to be serialized?
 Originally Posted by crptcblade
Add the attribute...
Code:
[XmlElement(IsNullable=true)]
to the fields you want serialized even when null.

i wish i could serialize you as a token of my appreciation. Thanks!
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|