|
-
Aug 6th, 2006, 06:44 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] XML serialization, hide some properties.
Hi,
I am XML-serializing my classes. But when the serialization takes place; all public properties are in the resulting XML-file. But there are certain properties that I do not want to be exported.
Is there a keyword or way to avoid the serialization of specific properties?
I tried several articles and tutorials, and even the Microsoft MSDN-library, but I did not find it anywhere.
Thank you in advance.
____________________________________________
Please rate my messages. Thank you!
____________________________________________
Bram Vandenbon
http://www.bramvandenbon.com
-
Aug 6th, 2006, 06:50 AM
#2
Re: XML serialization, hide some properties.
Mark them with the NonSerialized attribute...
eg:
VB Code:
<NonSerialized()> Public MyString As String
For a property, try using the XmlIgnore attribute::
VB Code:
<Xml.Serialization.XmlIgnore()> Public Property MyProperty() As Integer
Get
Return Me._int
End Get
Set(ByVal Value As Integer)
Me._int = Value
End Set
End Property
Last edited by Andy_P; Aug 6th, 2006 at 07:00 AM.
Reason: Added property example
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
|