示例VB.Net代码,用于从Big Query读取数据

时间:2013-02-19 12:48:00

标签: vb.net google-api-dotnet-client

我需要使用Google BigQuery API查询Google Big Query表。我在VB.NET中使用Visual Studio 2012。我在C#中找到了一个示例代码,我可以使用C#在Visual Studio 2012中进行一些小改动。

参考:Google BigQuery with .NET documentation/ samples

我需要VB.NET中的代码,所以我将代码转换为VB.Net,除了以下代码行外,所有内容编译都很好。

// 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为VB.NET中的代码提供错误“Type expected”。有谁知道VB.NET中这行代码的正确语法是什么?

1 个答案:

答案 0 :(得分:0)

正如您的错误描述的那样。 VB.Net不喜欢推断的数组初始化器,所以

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

应该是

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