0

I have a VB.NET class in which the attribute "NationalInsurance" should only show on the XML if this has met certain business conditions.

<Serializable()>
    <XmlType("Person")>
    Public Class Person
        <XmlAttribute("FirstName")>
        Public Name As String
        <XmlAttribute("LastName")>
        Public SirName As string
        <XmlAttribute("NationalInsurance")>
        Public NI As string
    End Class

The logic in VB.NET when setting data follows the pattern:

Dim personObject As New Person
personObject.Name = "John"
personObject.SirName = "Smith"

if (some business logic) then
    personObject.NI = 'AABB1122C'
end if

however whenever the if statement is skipped over, the NationalInsurance tag still showws on the XML

Aiden
  • 189
  • 2
  • 12

0 Answers0