Monday 28 August 2017

VB net Serialization : ShouldSerialize boolean function (not in MSDN)

When serializing a property it is possible to include it or exclude it using the boolean function ShouldSerializeXXXX where XXXX is the exact name of the property !
In MSDN there is no straight reference to it.

eg

<SXS.XmlAttribute(AttributeName:="desc")> Public Property desc As String = String.Empty

Public Function ShouldSerializedesc() As Boolean
   If desc = String.Empty Then Return False Else Return True
End Function

No comments:

Post a Comment