# Google.Cloud.Spanner.Data - Class SpannerDbType (5.13.0-beta07)

5.13.0-beta07 5.13.0-beta06 5.12.0 (latest) 5.11.0 5.10.0 5.9.0 5.8.0 5.7.0 5.6.0 5.5.0 5.4.0 5.3.0 5.2.0 5.1.0 5.0.0 4.6.0 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.0 3.15.1 3.14.0 3.13.0 3.12.0 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0

    public sealed class SpannerDbType

Reference documentation and code samples for the Google.Cloud.Spanner.Data class SpannerDbType.

Represents a Type that can be stored in a Spanner column or returned from a query.

## Inheritance

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

## Inherited Members

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

## Namespace

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

## Assembly

Google.Cloud.Spanner.Data.dll

## Properties

### Bool

    public static SpannerDbType Bool { get; }

`true` or `false`.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### Bytes

    public static SpannerDbType Bytes { get; }

A byte array (byte\[\]).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### Date

    public static SpannerDbType Date { get; }

A Date.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### DbType

    public DbType DbType { get; }

The corresponding [DbType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType#Google_Cloud_Spanner_Data_SpannerDbType_DbType) for this Cloud Spanner type.

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

### DefaultClrType

    public Type DefaultClrType { get; }

The default [Type](https://learn.microsoft.com/dotnet/api/system.type) for this Cloud Spanner type.

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

### Float32

    public static SpannerDbType Float32 { get; }

32 bit floating point number.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### Float64

    public static SpannerDbType Float64 { get; }

64 bit floating point number. This is equivalent to Float8 in the PostgreSQL dialect.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### Int64

    public static SpannerDbType Int64 { get; }

64 bit signed integer.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### Interval

    public static SpannerDbType Interval { get; }

Representation of Spanner's Interval type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### Json

    public static SpannerDbType Json { get; }

A JSON-formatted string as described in RFC 7159.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### Numeric

    public static SpannerDbType Numeric { get; }

A fixed-point number with 29 decimal digits of precision in the whole component and 9 decimal digits of precision in the fractional component.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### PgJsonb

    public static SpannerDbType PgJsonb { get; }

Representation of PostgreSQL JSONB type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### PgNumeric

    public static SpannerDbType PgNumeric { get; }

Representation of PostgreSQL numeric type.
The PostgreSQL numeric type has max precision of 147,455 and a max scale of 16383.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### PgOid

    public static SpannerDbType PgOid { get; }

Representation of PostgreSQL OID type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### Size

    public int? Size { get; }

The size of the Type, if set.

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

### String

    public static SpannerDbType String { get; }

A string.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### Timestamp

    public static SpannerDbType Timestamp { get; }

Date and Time.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### Unspecified

    public static SpannerDbType Unspecified { get; }

Not specified.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### Uuid

    public static SpannerDbType Uuid { get; }

Representation of Spanner UUID type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

## Methods

### ArrayOf(SpannerDbType)

    public static SpannerDbType ArrayOf(SpannerDbType elementType)

Creates an array of the specified type. This can be done on any arbitrary [SpannerDbType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType).
You may use any type that implements IEnumerable as a source for the array. The type of each
item is determined by `elementType`.
When calling [GetFieldValue\<T\>(string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDataReader#Google_Cloud_Spanner_Data_SpannerDataReader_GetFieldValue__1_System_String_) the default type
is [List\<T\>](https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1). You may, however, specify any type that implements IList which
has a default constructor.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `elementType` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` The type of each item in the array. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` |   |

### FromClrType(Type)

    public static SpannerDbType FromClrType(Type type)

Returns a SpannerDbType given a ClrType.
If the type cannot be determined, [Unspecified](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType#Google_Cloud_Spanner_Data_SpannerDbType_Unspecified) is returned.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `type` | `https://learn.microsoft.com/dotnet/api/system.type` The clrType to convert. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` | The best Spanner representation of the given Clr Type. |

### GetHashCode()

    public override int GetHashCode()

Serves as the default hash function.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` | A hash code for the current object. |

**Overrides** [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)

### ToString()

    public override string ToString()

Returns a string that represents the current object.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` | A string that represents the current object. |

**Overrides** [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

### TryParse(string, out SpannerDbType)

    public static bool TryParse(string spannerType, out SpannerDbType spannerDbType)

Given a string representation, returns an instance of [SpannerDbType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `spannerType` | `https://learn.microsoft.com/dotnet/api/system.string` A string representation of a SpannerDbType. See [ToString()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType#Google_Cloud_Spanner_Data_SpannerDbType_ToString). |
| `spannerDbType` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` If parsing was successful, then an instance of [SpannerDbType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType). Otherwise null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` | True if the parse was successful. |

### WithSize(int)

    public SpannerDbType WithSize(int size)

Returns a clone of this type with the specified size constraint.
Only valid on Google.Cloud.Spanner.V1.TypeCode.String and Google.Cloud.Spanner.V1.TypeCode.Bytes

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `size` | `https://learn.microsoft.com/dotnet/api/system.int32` Represents the number of characters (for Google.Cloud.Spanner.V1.TypeCode.String) or bytes (for Google.Cloud.Spanner.V1.TypeCode.Bytes) |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` | A new instance of [SpannerDbType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType) with the same Google.Cloud.Spanner.Data.SpannerDbType.TypeCode and new size. |