문제

I need to query Google Big Query table using Google BigQuery API. I am using Visual Studio 2012 with VB.NET. I found a sample code in C# and I could get it to work with a minor change in Visual Studio 2012 using C#.

Reference: Google BigQuery with .NET documentation/ samples

I need the code in VB.NET so I converted the code to VB.Net and everything compiles fine except the following line of code.

// Get the auth URL in C# that works fine:
            IAuthorizationState state = new AuthorizationState(new[] {  BigqueryService.Scopes.Bigquery.GetStringValue() });

    ' Get the auth URL in VB.NET that is giving an error “Type expected” :      
Dim state As IAuthorizationState = New AuthorizationState(New () {BigqueryService.Scopes.Bigquery.GetStringValue()})

Visual Studio give the error “Type expected” for the code in VB.NET. Anybody knows that what is the correct syntax in VB.NET for this line of code?

도움이 되었습니까?

해결책

It's exactly as your error describes. VB.Net doesn't like inferred array initializers so

Dim state As IAuthorizationState = New AuthorizationState(New () {BigqueryService.S...

should be something like

Dim state As IAuthorizationState = New AuthorizationState(New TheTypeOfArrayHere() {BigqueryService.S...
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top