Question Add group to xml using serialization

LaKirk

New member
Joined
Jun 25, 2013
Messages
4
Programming Experience
10+
My class serializes perfectly. but, the xml requirement changed and added another <Group> container around the xml output. my code:
VB.NET:
Public Class Materials
    Private _temp As String = ""
    Public Property temp() As String
        Get
            Return _temp
        End Get
        Set(ByVal value As String)
            _temp = value
        End Set
    End Property
End class

xml:
<Materials>
<temp/>
</Materials>
new xml:
<Materials>
 <Group>
  <temp/>
 </Group>
<Materials>

How do I add <Group> around the other 128 properties? I only showed the <temp>.

VB.NET:
 Dim objStreamWriter As New StreamWriter("u:\approve\NewMaterial.xml")
        Dim x As New XmlSerializer(newpart.GetType)
        x.Serialize(objStreamWriter, newpart)
        objStreamWriter.Close()
 
Back
Top