# Google.Cloud.Spanner.Data - Class SpannerParameterCollection (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 SpannerParameterCollection : DbParameterCollection, IDataParameterCollection, IList, ICollection, IEnumerable<SpannerParameter>, IEnumerable

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

Represents a collection of parameters associated with a [SpannerCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand) and their
respective mappings to columns in a DataSet.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [MarshalByRefObject](https://learn.microsoft.com/dotnet/api/system.marshalbyrefobject) \> [DbParameterCollection](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection) \> SpannerParameterCollection

## Implements

[IDataParameterCollection](https://learn.microsoft.com/dotnet/api/system.data.idataparametercollection), [IList](https://learn.microsoft.com/dotnet/api/system.collections.ilist), [ICollection](https://learn.microsoft.com/dotnet/api/system.collections.icollection), [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)[SpannerParameter](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameter), [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.ienumerable)

## Inherited Members

[DbParameterCollection.this\[int\]](https://learn.microsoft.com/dotnet/api/system.int32) [DbParameterCollection.this\[string\]](https://learn.microsoft.com/dotnet/api/system.string) [MarshalByRefObject.GetLifetimeService()](https://learn.microsoft.com/dotnet/api/system.marshalbyrefobject.getlifetimeservice) [MarshalByRefObject.InitializeLifetimeService()](https://learn.microsoft.com/dotnet/api/system.marshalbyrefobject.initializelifetimeservice) [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.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

## Constructors

### SpannerParameterCollection(IEnumerable\<SpannerParameter\>)

    public SpannerParameterCollection(IEnumerable<SpannerParameter> initialParameters = null)

Initializes a new SpannerParameterCollection with the given set of optional [SpannerParameter](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameter)
objects.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `initialParameters` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameter` The initial parameters to include in the collection. |

## Properties

### Count

    public override int Count { get; }

Specifies the number of items in the collection.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` | The number of items in the collection. |

**Overrides** [DbParameterCollection.Count](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.count)

### IsFixedSize

    public override bool IsFixedSize { get; }

Specifies whether the collection is a fixed size.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the collection is a fixed size; otherwise [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). |

**Overrides** System.Data.Common.DbParameterCollection.IsFixedSize

### IsReadOnly

    public override bool IsReadOnly { get; }

Specifies whether the collection is read-only.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the collection is read-only; otherwise [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). |

**Overrides** System.Data.Common.DbParameterCollection.IsReadOnly

### IsSynchronized

    public override bool IsSynchronized { get; }

Specifies whether the collection is synchronized.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the collection is synchronized; otherwise [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). |

**Overrides** System.Data.Common.DbParameterCollection.IsSynchronized

### SyncRoot

    public override object SyncRoot { get; }

Specifies the [object](https://learn.microsoft.com/dotnet/api/system.object) to be used to synchronize access to the collection.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.object` | A [object](https://learn.microsoft.com/dotnet/api/system.object) to be used to synchronize access to the [DbParameterCollection](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection). |

**Overrides** System.Data.Common.DbParameterCollection.SyncRoot

## Methods

### Add(object)

    public override int Add(object value)

Adds the specified [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object to the [DbParameterCollection](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The [Value](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter.value) of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) to add to the collection. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` | The index of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object in the collection. |

**Overrides** [DbParameterCollection.Add(object)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.add)

### Add(string, SpannerDbType)

    public SpannerParameter Add(string parameterName, SpannerDbType dbType)

Adds a new [SpannerParameter](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameter) to the [SpannerParameterCollection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameterCollection).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parameterName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of the parameter. For Insert, Update and Delete commands, this name should be the name of a valid Column in a Spanner table. In Select commands, this name should be the name of a parameter used in the SQL Query. Must not be null |
| `dbType` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` One of the [SpannerDbType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType) values that indicates the type of the parameter. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameter` | The parameter which has been added. |

### Add(string, SpannerDbType, object)

    public SpannerParameter Add(string parameterName, SpannerDbType dbType, object value)

Adds a new [SpannerParameter](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameter) to the [SpannerParameterCollection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameterCollection)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parameterName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of the parameter. For Insert, Update and Delete commands, this name should be the name of a valid Column in a Spanner table. In Select commands, this name should be the name of a parameter used in the SQL Query. Must not be null. |
| `dbType` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType` One of the [SpannerDbType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType) values that indicates the type of the parameter. Must not be null. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` An object that is the value of the SpannerParameter. May be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameter` | The parameter which has been added. |

### AddRange(Array)

    public override void AddRange(Array values)

Adds an array of items with the specified values to the [DbParameterCollection](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `values` | `https://learn.microsoft.com/dotnet/api/system.array` An array of values of type [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) to add to the collection. |

**Overrides** [DbParameterCollection.AddRange(Array)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.addrange)

### Clear()

    public override void Clear()

Removes all [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) values from the [DbParameterCollection](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection).
**Overrides** [DbParameterCollection.Clear()](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.clear)

### Clone()

    public SpannerParameterCollection Clone()

Clones the collection.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameterCollection` | A cloned copy of this instance. |

### Contains(object)

    public override bool Contains(object value)

Indicates whether a [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) with the specified [Value](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter.value) is contained in the collection.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The [Value](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter.value) of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) to look for in the collection. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) is in the collection; otherwise [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). |

**Overrides** [DbParameterCollection.Contains(object)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.contains#system-data-common-dbparametercollection-contains(system-object))

### Contains(string)

    public override bool Contains(string value)

Indicates whether a [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) with the specified name exists in the collection.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://learn.microsoft.com/dotnet/api/system.string` The name of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) to look for in the collection. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) is in the collection; otherwise [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). |

**Overrides** [DbParameterCollection.Contains(string)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.contains#system-data-common-dbparametercollection-contains(system-string))

### CopyTo(Array, int)

    public override void CopyTo(Array array, int index)

Copies an array of items to the collection starting at the specified index.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `array` | `https://learn.microsoft.com/dotnet/api/system.array` The array of items to copy to the collection. |
| `index` | `https://learn.microsoft.com/dotnet/api/system.int32` The index in the collection to copy the items. |

**Overrides** [DbParameterCollection.CopyTo(Array, int)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.copyto)

### GetEnumerator()

    public override IEnumerator GetEnumerator()

Exposes the [GetEnumerator()](https://learn.microsoft.com/dotnet/api/system.collections.ienumerable.getenumerator) method, which supports a simple iteration over a collection by a .NET Framework data provider.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.ienumerator` | An [IEnumerator](https://learn.microsoft.com/dotnet/api/system.collections.ienumerator) that can be used to iterate through the collection. |

**Overrides** System.Data.Common.DbParameterCollection.GetEnumerator()

### GetParameter(int)

    protected override DbParameter GetParameter(int index)

Returns the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object at the specified index in the collection.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://learn.microsoft.com/dotnet/api/system.int32` The index of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) in the collection. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter` | The [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object at the specified index in the collection. |

**Overrides** [DbParameterCollection.GetParameter(int)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.getparameter#system-data-common-dbparametercollection-getparameter(system-int32))

### GetParameter(string)

    protected override DbParameter GetParameter(string parameterName)

Returns [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) the object with the specified name.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `parameterName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) in the collection. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter` | The [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) the object with the specified name. |

**Overrides** [DbParameterCollection.GetParameter(string)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.getparameter#system-data-common-dbparametercollection-getparameter(system-string))

### IndexOf(object)

    public override int IndexOf(object value)

Returns the index of the specified [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object in the collection. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` | The index of the specified [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object. |

**Overrides** [DbParameterCollection.IndexOf(object)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.indexof#system-data-common-dbparametercollection-indexof(system-object))

### IndexOf(string)

    public override int IndexOf(string parameterName)

Returns the index of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object with the specified name.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `parameterName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object in the collection. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` | The index of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object with the specified name. |

**Overrides** [DbParameterCollection.IndexOf(string)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.indexof#system-data-common-dbparametercollection-indexof(system-string))

### Insert(int, object)

    public override void Insert(int index, object value)

Inserts the specified index of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object with the specified name into the collection at the specified index.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://learn.microsoft.com/dotnet/api/system.int32` The index at which to insert the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object to insert into the collection. |

**Overrides** [DbParameterCollection.Insert(int, object)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.insert)

### Remove(object)

    public override void Remove(object value)

Removes the specified [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object from the collection.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object to remove. |

**Overrides** [DbParameterCollection.Remove(object)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.remove)

### RemoveAt(int)

    public override void RemoveAt(int index)

Removes the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object at the specified from the collection.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://learn.microsoft.com/dotnet/api/system.int32` The index where the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object is located. |

**Overrides** [DbParameterCollection.RemoveAt(int)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.removeat#system-data-common-dbparametercollection-removeat(system-int32))

### RemoveAt(string)

    public override void RemoveAt(string parameterName)

Removes the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object with the specified name from the collection.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `parameterName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object to remove. |

**Overrides** [DbParameterCollection.RemoveAt(string)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.removeat#system-data-common-dbparametercollection-removeat(system-string))

### SetParameter(int, DbParameter)

    protected override void SetParameter(int index, DbParameter value)

Sets the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object at the specified index to a new value.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://learn.microsoft.com/dotnet/api/system.int32` The index where the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object is located. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter` The new [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) value. |

**Overrides** [DbParameterCollection.SetParameter(int, DbParameter)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.setparameter#system-data-common-dbparametercollection-setparameter(system-int32-system-data-common-dbparameter))

### SetParameter(string, DbParameter)

    protected override void SetParameter(string parameterName, DbParameter value)

Sets the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object with the specified name to a new value.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parameterName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of the [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) object in the collection. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter` The new [DbParameter](https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter) value. |

**Overrides** [DbParameterCollection.SetParameter(string, DbParameter)](https://learn.microsoft.com/dotnet/api/system.data.common.dbparametercollection.setparameter#system-data-common-dbparametercollection-setparameter(system-string-system-data-common-dbparameter))