When serializing/de-serializing certain classes I've come across the need to flag or mark certain properties as CDATA elements (due to their content). I am currently handling this like so:
    <XmlElement("MessageText")> _
    Public Property XmlContentLeft() As XmlCDataSection
        Get
            Dim doc As New XmlDataDocument()
            Dim cd As XmlCDataSection = doc.CreateCDataSection(Me.MessageText)
            Return cd
        End Get
        Set(ByVal value As XmlCDataSection)
            Me.MessageText = value.Value
        End Set
    End Property
    <XmlIgnore()> _
    Public Property MessageText() As String
        Get
            Return _messageText
        End Get
        Set(ByVal value As String)
            _messageText= value
        End Set
    End Property
Now while this works great it has drawbacks -- I now have duplicate properties for anything I want to be a CDATA element and I have to write extra code for these properties.
So my question is whether or not there is a better way to do this? I don't want to have to write custom schemas or serialization routines for each class. In an ideal scenario I'd be able to add an attribute to these properties so they are automatically treated as CDATA elements.