tags:

views:

80

answers:

1

I have seen there are many example in C# version. Same also as DataContractJsonSerializer class in MSDN. Anyone pls help me on VB.net version.

Regards.

A: 

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Dim ser As New DataContractJsonSerializer(GetType(Product)) Using fs As FileStream = File.OpenRead("c:\jsonText.txt")

            Dim product As Product = TryCast(ser.ReadObject(fs), Product)
            MessageBox.Show("Product Name: " & product.Name)
        End Using
    End Sub
End Class

<Serializable()> _
Public Class Product
    Public Name As String
End Class

End Namespace

Here is the vb.net sample taken from msdn and converted by developerfusion converter

cheers

Mesut