Conversion of C# code to VB code

Posted on 2014-08-07
Last Modified: 2014-08-08
Hi everyone,

I'm getting into Google's BigQuery, and am trying to piece together some sample code to do some basic functions.  All sample code I have come across on the .NET side has been C#.  I was hoping to write my applications in VB and most of the code is easily converted, except of two lines:

        ServiceAccountCredential credential = new ServiceAccountCredential(
            new ServiceAccountCredential.Initializer(serviceAccountEmail)
                Scopes = new[] { BigqueryService.Scope.Bigquery }

Open in new window


        var service = new BigqueryService(new BaseClientService.Initializer()
            HttpClientInitializer = credential,
            ApplicationName = ApplicationName

Open in new window

I have tried multiple online code converters to no avail.  Any assistance would be greatly appreciated.  

I'm using 4.5 framework for my app if that is important.

Thanks in advance,
Question by:dthansen
    LVL 32

    Accepted Solution

    See How to: Declare an Object by Using an Object Initializer (Visual Basic).

    Dim service As BigqueryService = New BigqueryService(
    	New BaseClientService.Initializer() With { 
    		.HttpClientInitializer = credential, 
    		.ApplicationName = ApplicationName 

    Open in new window

    But you don't need to make it in one declaration.
    LVL 32

    Expert Comment

    LVL 33

    Expert Comment

    by:Mike Eghtebas
    Also check this site for converting to c# and c# to

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    732 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

    19 Experts available now in Live!

    Get 1:1 Help Now