# Class NpgsqlBatchCommandCollection

Namespace
  Npgsql

Assembly
  Npgsql.dll

The base class for a collection of instances of DbBatchCommand, contained in a DbBatch.

    public class NpgsqlBatchCommandCollection : DbBatchCommandCollection, IList<DbBatchCommand>, ICollection<DbBatchCommand>, IEnumerable<DbBatchCommand>, IList<NpgsqlBatchCommand>, ICollection<NpgsqlBatchCommand>, IEnumerable<NpgsqlBatchCommand>, IEnumerable

Inheritance
  object
  DbBatchCommandCollection
  NpgsqlBatchCommandCollection

Implements
  IList<DbBatchCommand>
  ICollection<DbBatchCommand>
  IEnumerable<DbBatchCommand>
  IList<NpgsqlBatchCommand>
  ICollection<NpgsqlBatchCommand>
  IEnumerable<NpgsqlBatchCommand>
  IEnumerable

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## Properties

### Count

Gets the number of elements contained in the ICollection<T>.

    public override int Count { get; }

#### Property Value

int

  The number of elements contained in the ICollection<T>.

### IsReadOnly

Specifies whether the collection is read-only.

    public override bool IsReadOnly { get; }

#### Property Value

bool

  true if the collection is read-only; otherwise false.

### this[int]

Gets or sets the element at the specified index.

    public NpgsqlBatchCommand this[int index] { get; set; }

#### Parameters

`index` int

  The zero-based index of the element to get or set.

#### Property Value

NpgsqlBatchCommand

  The element at the specified index.

#### Exceptions

ArgumentOutOfRangeException

  `index` is not a valid index in the IList<T>.

NotSupportedException

  The property is set and the IList<T> is read-only.

## Methods

### Add(NpgsqlBatchCommand)

Adds an item to the ICollection<T>.

    public void Add(NpgsqlBatchCommand item)

#### Parameters

`item` NpgsqlBatchCommand

  The object to add to the ICollection<T>.

#### Exceptions

NotSupportedException

  The ICollection<T> is read-only.

### Add(DbBatchCommand)

Adds the specified DbBatchCommand object to the DbBatchCommandCollection.

    public override void Add(DbBatchCommand item)

#### Parameters

`item` DbBatchCommand

  The object to add to the ICollection<T>.

### Clear()

Removes all DbBatchCommand values from the DbBatchCommandCollection.

    public override void Clear()

### Contains(NpgsqlBatchCommand)

Determines whether the ICollection<T> contains a specific value.

    public bool Contains(NpgsqlBatchCommand item)

#### Parameters

`item` NpgsqlBatchCommand

  The object to locate in the ICollection<T>.

#### Returns

bool

  true if `item` is found in the ICollection<T>; otherwise, false.

### Contains(DbBatchCommand)

Indicates whether a DbBatchCommand is contained in the collection.

    public override bool Contains(DbBatchCommand item)

#### Parameters

`item` DbBatchCommand

  The object to locate in the ICollection<T>.

#### Returns

bool

  true if the DbBatchCommand is in the collection; otherwise false.

### CopyTo(NpgsqlBatchCommand[], int)

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

    public void CopyTo(NpgsqlBatchCommand[] array, int arrayIndex)

#### Parameters

`array` NpgsqlBatchCommand[]

  The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.

`arrayIndex` int

  The zero-based index in `array` at which copying begins.

#### Exceptions

ArgumentNullException

  `array` is null.

ArgumentOutOfRangeException

  `arrayIndex` is less than 0.

ArgumentException

  The number of elements in the source ICollection<T> is greater than the available space from `arrayIndex` to the end of the destination `array`.

### CopyTo(DbBatchCommand[], int)

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

    public override void CopyTo(DbBatchCommand[] array, int arrayIndex)

#### Parameters

`array` DbBatchCommand[]

  The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.

`arrayIndex` int

  The zero-based index in `array` at which copying begins.

### GetBatchCommand(int)

    protected override DbBatchCommand GetBatchCommand(int index)

#### Parameters

`index` int

#### Returns

DbBatchCommand

### GetEnumerator()

Returns the DbBatchCommand object at the specified index in the collection.

    public override IEnumerator<DbBatchCommand> GetEnumerator()

#### Returns

IEnumerator<DbBatchCommand>

  The DbBatchCommand object at the specified index in the collection.

### IndexOf(NpgsqlBatchCommand)

Determines the index of a specific item in the IList<T>.

    public int IndexOf(NpgsqlBatchCommand item)

#### Parameters

`item` NpgsqlBatchCommand

  The object to locate in the IList<T>.

#### Returns

int

  The index of `item` if found in the list; otherwise, -1.

### IndexOf(DbBatchCommand)

Returns the index of the specified DbBatchCommand object.

    public override int IndexOf(DbBatchCommand item)

#### Parameters

`item` DbBatchCommand

  The object to locate in the IList<T>.

#### Returns

int

  The index of the specified DbBatchCommand object.

### Insert(int, NpgsqlBatchCommand)

Inserts an item to the IList<T> at the specified index.

    public void Insert(int index, NpgsqlBatchCommand item)

#### Parameters

`index` int

  The zero-based index at which `item` should be inserted.

`item` NpgsqlBatchCommand

  The object to insert into the IList<T>.

#### Exceptions

ArgumentOutOfRangeException

  `index` is not a valid index in the IList<T>.

NotSupportedException

  The IList<T> is read-only.

### Insert(int, DbBatchCommand)

Inserts the specified index of the DbBatchCommand object with the specified name into the collection at the specified index.

    public override void Insert(int index, DbBatchCommand item)

#### Parameters

`index` int

  The index at which to insert the DbBatchCommand object.

`item` DbBatchCommand

  The object to insert into the IList<T>.

### Remove(NpgsqlBatchCommand)

Removes the first occurrence of a specific object from the ICollection<T>.

    public bool Remove(NpgsqlBatchCommand item)

#### Parameters

`item` NpgsqlBatchCommand

  The object to remove from the ICollection<T>.

#### Returns

bool

  true if `item` was successfully removed from the ICollection<T>; otherwise, false. This method also returns false if `item` is not found in the original ICollection<T>.

#### Exceptions

NotSupportedException

  The ICollection<T> is read-only.

### Remove(DbBatchCommand)

Removes the specified DbBatchCommand object from the collection.

    public override bool Remove(DbBatchCommand item)

#### Parameters

`item` DbBatchCommand

  The object to remove from the ICollection<T>.

#### Returns

bool

  true if `item` was successfully removed; otherwise, false. This method also returns false if `item` was not found in the DbBatchCommandCollection.

### RemoveAt(int)

Removes the DbBatchCommand object at the specified from the collection.

    public override void RemoveAt(int index)

#### Parameters

`index` int

  The index where the DbBatchCommand object is located.

### SetBatchCommand(int, DbBatchCommand)

Sets the DbBatchCommand object at the specified index to a new value.

    protected override void SetBatchCommand(int index, DbBatchCommand batchCommand)

#### Parameters

`index` int

  The index where the DbBatchCommand object is located.

`batchCommand` DbBatchCommand