Say I have a class
Class Business
Name as string
end Class
The XML will be
<Business>
<Name>Hello World</Name>
</Business>
What about if I want that to be
<Business Name="Hello World" /> instead
How would I do so?
Printable View
Say I have a class
Class Business
Name as string
end Class
The XML will be
<Business>
<Name>Hello World</Name>
</Business>
What about if I want that to be
<Business Name="Hello World" /> instead
How would I do so?
you need to use the XMLAttribute markup on the property....
-tgCode:Imports System.Xml.Serialization
<Serializable()> _
Public Class Business
Private _name As String
<XmlAttribute()> _
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
End Class
Where can I see more documentation on this?
Yes I googled and bing the whole thing:
This
http://msdn.microsoft.com/en-us/libr...attribute.aspx
doesn't look like it.
yeah, no that's not it.....
try the OTHER namespace:
System.Xml.Serialization
or xml.serialization.xmlattribute ... the one you found was for the xml dom....
http://msdn.microsoft.com/en-us/libr...attribute.aspx
Yeah... the search is great, but sometimes you jsut gotta know exactly how to search what you're looking for.
Hope it helps.
-tg