I have a wrapper class to help deserialize incoming json messages. At the moment I am using it like this.
Dim oXMessage As XMessage = JsonConvert.DeserializeObject(Of XMessage)(message)
I wanted to create a constructor for the class so I can instantiate it more cleanly. Like this
Dim oXMessage as XMessage = New XMessage(message)
I have tried the below constructor but it does not work. Can someone point me in the right direction please?
Public Class XMessage
<JsonProperty("e")> Public MessageType As String
<JsonProperty("data")> Public MessageData As Object
<JsonProperty("ok")> Public MessageOk As String
Public Sub New(message As String)
Me = JsonConvert.DeserializeObject(Of Me)(message)
End Sub
End Class