Solved

I need C# converted to VB.net

Posted on 2016-10-14
1
52 Views
Last Modified: 2016-10-19
Hi Experts,
I need the code below converted from C# to vb.net.

Already tried all the conversion website, and have not been successful.


JsonTextReader reader = new JsonTextReader(new StringReader(json));
while (reader.Read())
{
    if (reader.Value != null)
    {
        Console.WriteLine("Token: {0}, Value: {1}", reader.TokenType, reader.Value);
    }
    else
    {
        Console.WriteLine("Token: {0}", reader.TokenType);
    }
}

Open in new window


Thanks in advance,
mrotor
0
Comment
Question by:mainrotor
1 Comment
 
LVL 20

Accepted Solution

by:
Russ Suter earned 500 total points
ID: 41844436
Not sure where JsonTextReader is coming from (don't know the Imports location or reference) but this should work...
        Dim reader As New JsonTextReader(New StringReader(json))
        While reader.Read()
            If reader.Value IsNot Nothing Then
                Console.WriteLine("Token: {0}, Value: {1}", reader.TokenType, reader.Value)
            Else
                Console.WriteLine("Token: {0}", reader.TokenType)
            End If
        End While

Open in new window

EDIT: I'm assuming the JsonTextReader is coming from the Newtonsoft.Json package and that the variable json is just a string declared elsewhere. The above sample compiles just fine but without knowing the contents of json I can't say whether or not it produces the results you expect.
1

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now