# Google BigQuery v2 API - Class BigQueryParameter (3.12.0)

3.12.0 (latest) 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.0 3.1.0 3.0.0 2.4.0 2.3.0 2.2.0

    public sealed class BigQueryParameter

Reference documentation and code samples for the Google BigQuery v2 API class BigQueryParameter.

A parameter within a SQL query.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> BigQueryParameter

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.BigQuery.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2)

## Assembly

Google.Cloud.BigQuery.V2.dll

## Remarks


Each parameter has a name, type and value. Names are irrelevant for queries using
positional parameters. All scalar types are converted into strings
before being passed to the server, but the nature of the conversion depends on the specified type.


The following list shows the correspondence between the parameter type and valid value types.
All scalar types may be specified as a string value, which will not be validated or converted on the client,
but passed to the API as-is.

- `Bool`: `System.Boolean`
- `Int64`: `System.Int16`, `System.Int32`, `System.Int64`, `System.UInt16`, `System.UInt32`, `System.UInt64`
- `Float64`: Any type valid for `Int64`, as well as `System.Single` and `System.Double`
- `String`: `System.String`
- `Bytes`: `System.Byte[]`
- `Date`: `System.DateTime`, `System.DateTimeOffset`
- `DateTime`: `System.DateTime`, `System.DateTimeOffset`
- `Time`: `System.DateTime`, `System.DateTimeOffset`, `System.TimeSpan`
- `Timestamp`: `System.DateTime`, `System.DateTimeOffset`
- `Numeric`: `Google.Cloud.BigQuery.V1.BigQueryNumeric`
- `Geography`: `Google.Cloud.BigQuery.V1.BigQueryGeography`
- `Json`: `System.String`
- `Array`: An `IReadOnlyList<T>` of any of the above types corresponding to the [ArrayElementType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryParameter#Google_Cloud_BigQuery_V2_BigQueryParameter_ArrayElementType), which will be inferred from the value's element type if not otherwise specified.


If the parameter type is null, it is inferred from the value. A [TimeSpan](https://learn.microsoft.com/dotnet/api/system.timespan) value is
always assumed to be a [Time](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryDbType#Google_Cloud_BigQuery_V2_BigQueryDbType_Time), a [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset) value is
always assumed to be a [Timestamp](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryDbType#Google_Cloud_BigQuery_V2_BigQueryDbType_Timestamp), and a [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) value is assumed
to be [DateTime](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryDbType#Google_Cloud_BigQuery_V2_BigQueryDbType_DateTime) regardless of its [Kind](https://learn.microsoft.com/dotnet/api/system.datetime.kind).


If an array parameter doesn't specify the array type, the type is inferred from the type of the value.


Array parameters must not have a value of null, and all the elements must be non-null as well.


If a [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) value is provided for a [Timestamp](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryDbType#Google_Cloud_BigQuery_V2_BigQueryDbType_Timestamp) parameter, the
value must have a [Kind](https://learn.microsoft.com/dotnet/api/system.datetime.kind) of [Utc](https://learn.microsoft.com/dotnet/api/system.datetimekind#system-datetimekind-utc).


Struct parameters are currently not supported.

## Constructors

### BigQueryParameter()

    public BigQueryParameter()

Constructs a parameter with no name, initial value or type.

### BigQueryParameter(BigQueryDbType)

    public BigQueryParameter(BigQueryDbType type)

Constructs a parameter with no name, initial value or type.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `type` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryDbType` The initial type of the parameter. |

### BigQueryParameter(BigQueryDbType?, object)

    public BigQueryParameter(BigQueryDbType? type, object value)

Constructs a parameter with no name, and the specified type and value.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `type` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryDbType` The initial type of the parameter. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The initial value of the parameter. |

### BigQueryParameter(string)

    public BigQueryParameter(string name)

Constructs a parameter with the given name but no initial value or type.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` The initial name of the parameter. |

### BigQueryParameter(string, BigQueryDbType?)

    public BigQueryParameter(string name, BigQueryDbType? type)

Constructs a parameter with the given name and type, but no initial value.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` The initial name of the parameter. |
| `type` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryDbType` The initial type of the parameter. |

### BigQueryParameter(string, BigQueryDbType?, object)

    public BigQueryParameter(string name, BigQueryDbType? type, object value)

Constructs a parameter with the given name, type and value.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` The initial name of the parameter. |
| `type` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryDbType` The initial type of the parameter. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The initial value of the parameter. |

## Properties

### ArrayElementType

    public BigQueryDbType? ArrayElementType { get; set; }

The type of the nested elements, for array parameters. If this is null, the type is inferred from the value.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryDbType` |   |

### Name

    public string Name { get; set; }

The name of the parameter. This is irrelevant for positional parameters.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Type

    public BigQueryDbType? Type { get; set; }

The type of the parameter. If this is null, the type of the parameter is inferred from the value.
Otherwise, the value must be of one of the supported types for the parameter type. See the [class documentation](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryParameter)
for details.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryDbType` |   |

### Value

    public object Value { get; set; }

The value of the parameter. If this is null, the type of the parameter must be specified
explicitly.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.object` |   |