Class NpgsqlParameterCollection
- Namespace
- Npgsql
- Assembly
- Npgsql.dll
Represents a collection of parameters relevant to a NpgsqlCommand as well as their respective mappings to columns in a DataSet. This class cannot be inherited.
public sealed class NpgsqlParameterCollection : DbParameterCollection, IDataParameterCollection, IList, ICollection, IList<NpgsqlParameter>, ICollection<NpgsqlParameter>, IEnumerable<NpgsqlParameter>, IEnumerable
- Inheritance
-
NpgsqlParameterCollection
- Implements
- Inherited Members
Properties
Count
Gets the number of NpgsqlParameter objects in the collection.
public override int Count { get; }
Property Value
- int
The number of NpgsqlParameter objects in the collection.
IsFixedSize
public override bool IsFixedSize { get; }
Property Value
IsReadOnly
public override bool IsReadOnly { get; }
Property Value
IsSynchronized
public override bool IsSynchronized { get; }
Property Value
this[int]
Gets the NpgsqlParameter at the specified index.
public NpgsqlParameter this[int index] { get; set; }
Parameters
index
intThe zero-based index of the NpgsqlParameter to retrieve.
Property Value
- NpgsqlParameter
The NpgsqlParameter at the specified index.
this[string]
Gets the NpgsqlParameter with the specified name.
public NpgsqlParameter this[string parameterName] { get; set; }
Parameters
parameterName
stringThe name of the NpgsqlParameter to retrieve.
Property Value
- NpgsqlParameter
The NpgsqlParameter with the specified name, or a null reference if the parameter is not found.
SyncRoot
public override object SyncRoot { get; }
Property Value
Methods
Add(NpgsqlParameter)
Adds the specified NpgsqlParameter object to the NpgsqlParameterCollection.
public NpgsqlParameter Add(NpgsqlParameter value)
Parameters
value
NpgsqlParameterThe NpgsqlParameter to add to the collection.
Returns
- NpgsqlParameter
The index of the new NpgsqlParameter object.
Add(object)
public override int Add(object value)
Parameters
value
object
Returns
Add(string, NpgsqlDbType)
Adds a NpgsqlParameter to the NpgsqlParameterCollection given the parameter name and the data type.
public NpgsqlParameter Add(string parameterName, NpgsqlDbType parameterType)
Parameters
parameterName
stringThe name of the parameter.
parameterType
NpgsqlDbTypeOne of the DbType values.
Returns
- NpgsqlParameter
The index of the new NpgsqlParameter object.
Add(string, NpgsqlDbType, int)
Adds a NpgsqlParameter to the NpgsqlParameterCollection with the parameter name, the data type, and the column length.
public NpgsqlParameter Add(string parameterName, NpgsqlDbType parameterType, int size)
Parameters
parameterName
stringThe name of the parameter.
parameterType
NpgsqlDbTypeOne of the DbType values.
size
intThe length of the column.
Returns
- NpgsqlParameter
The index of the new NpgsqlParameter object.
Add(string, NpgsqlDbType, int, string)
Adds a NpgsqlParameter to the NpgsqlParameterCollection with the parameter name, the data type, the column length, and the source column name.
public NpgsqlParameter Add(string parameterName, NpgsqlDbType parameterType, int size, string sourceColumn)
Parameters
parameterName
stringThe name of the parameter.
parameterType
NpgsqlDbTypeOne of the DbType values.
size
intThe length of the column.
sourceColumn
stringThe name of the source column.
Returns
- NpgsqlParameter
The index of the new NpgsqlParameter object.
AddRange(Array)
public override void AddRange(Array values)
Parameters
values
Array
AddWithValue(NpgsqlDbType, object)
Adds a NpgsqlParameter to the NpgsqlParameterCollection given the specified data type and value.
public NpgsqlParameter AddWithValue(NpgsqlDbType parameterType, object value)
Parameters
parameterType
NpgsqlDbTypeOne of the NpgsqlDbType values.
value
objectThe Value of the NpgsqlParameter to add to the collection.
Returns
- NpgsqlParameter
The paramater that was added.
AddWithValue(object)
Adds a NpgsqlParameter to the NpgsqlParameterCollection given the specified value.
public NpgsqlParameter AddWithValue(object value)
Parameters
value
objectThe Value of the NpgsqlParameter to add to the collection.
Returns
- NpgsqlParameter
The paramater that was added.
AddWithValue(string, NpgsqlDbType, int, object)
Adds a NpgsqlParameter to the NpgsqlParameterCollection given the specified parameter name and value.
public NpgsqlParameter AddWithValue(string parameterName, NpgsqlDbType parameterType, int size, object value)
Parameters
parameterName
stringThe name of the NpgsqlParameter.
parameterType
NpgsqlDbTypeOne of the NpgsqlDbType values.
size
intThe length of the column.
value
objectThe Value of the NpgsqlParameter to add to the collection.
Returns
- NpgsqlParameter
The paramater that was added.
AddWithValue(string, NpgsqlDbType, int, string, object)
Adds a NpgsqlParameter to the NpgsqlParameterCollection given the specified parameter name and value.
public NpgsqlParameter AddWithValue(string parameterName, NpgsqlDbType parameterType, int size, string sourceColumn, object value)
Parameters
parameterName
stringThe name of the NpgsqlParameter.
parameterType
NpgsqlDbTypeOne of the NpgsqlDbType values.
size
intThe length of the column.
sourceColumn
stringThe name of the source column.
value
objectThe Value of the NpgsqlParameter to add to the collection.
Returns
- NpgsqlParameter
The paramater that was added.
AddWithValue(string, NpgsqlDbType, object)
Adds a NpgsqlParameter to the NpgsqlParameterCollection given the specified parameter name, data type and value.
public NpgsqlParameter AddWithValue(string parameterName, NpgsqlDbType parameterType, object value)
Parameters
parameterName
stringThe name of the NpgsqlParameter.
parameterType
NpgsqlDbTypeOne of the NpgsqlDbType values.
value
objectThe Value of the NpgsqlParameter to add to the collection.
Returns
- NpgsqlParameter
The paramater that was added.
AddWithValue(string, object)
Adds a NpgsqlParameter to the NpgsqlParameterCollection given the specified parameter name and value.
public NpgsqlParameter AddWithValue(string parameterName, object value)
Parameters
parameterName
stringThe name of the NpgsqlParameter.
value
objectThe Value of the NpgsqlParameter to add to the collection.
Returns
- NpgsqlParameter
The paramater that was added.
Clear()
Removes all items from the collection.
public override void Clear()
Contains(NpgsqlParameter)
Report whether the specified parameter is present in the collection.
public bool Contains(NpgsqlParameter item)
Parameters
item
NpgsqlParameterParameter to find.
Returns
- bool
True if the parameter was found, otherwise false.
Contains(object)
public override bool Contains(object value)
Parameters
value
object
Returns
Contains(string)
public override bool Contains(string parameterName)
Parameters
parameterName
string
Returns
CopyTo(NpgsqlParameter[], int)
Convert collection to a System.Array.
public void CopyTo(NpgsqlParameter[] array, int arrayIndex)
Parameters
array
NpgsqlParameter[]Destination array.
arrayIndex
intStarting index in destination array.
CopyTo(Array, int)
public override void CopyTo(Array array, int index)
Parameters
GetEnumerator()
public override IEnumerator GetEnumerator()
Returns
GetParameter(int)
protected override DbParameter GetParameter(int index)
Parameters
index
int
Returns
GetParameter(string)
protected override DbParameter GetParameter(string parameterName)
Parameters
parameterName
string
Returns
IndexOf(NpgsqlParameter)
Report the offset within the collection of the given parameter.
public int IndexOf(NpgsqlParameter item)
Parameters
item
NpgsqlParameterParameter to find.
Returns
- int
Index of the parameter, or -1 if the parameter is not present.
IndexOf(object)
public override int IndexOf(object value)
Parameters
value
object
Returns
IndexOf(string)
public override int IndexOf(string parameterName)
Parameters
parameterName
string
Returns
Insert(int, NpgsqlParameter)
Insert the specified parameter into the collection.
public void Insert(int index, NpgsqlParameter item)
Parameters
index
intIndex of the existing parameter before which to insert the new one.
item
NpgsqlParameterParameter to insert.
Insert(int, object)
public override void Insert(int index, object value)
Parameters
Remove(NpgsqlParameter)
Remove the specified parameter from the collection.
public bool Remove(NpgsqlParameter item)
Parameters
item
NpgsqlParameterParameter to remove.
Returns
- bool
True if the parameter was found and removed, otherwise false.
Remove(object)
Removes the specified NpgsqlParameter from the collection.
public override void Remove(object value)
Parameters
value
objectThe NpgsqlParameter to remove from the collection.
Remove(string)
Removes the specified NpgsqlParameter from the collection.
public void Remove(string parameterName)
Parameters
parameterName
stringThe name of the NpgsqlParameter to remove from the collection.
RemoveAt(int)
Removes the specified NpgsqlParameter from the collection using a specific index.
public override void RemoveAt(int index)
Parameters
index
intThe zero-based index of the parameter.
RemoveAt(string)
public override void RemoveAt(string parameterName)
Parameters
parameterName
string
SetParameter(int, DbParameter)
protected override void SetParameter(int index, DbParameter value)
Parameters
index
intvalue
DbParameter
SetParameter(string, DbParameter)
protected override void SetParameter(string parameterName, DbParameter value)
Parameters
parameterName
stringvalue
DbParameter
ToArray()
Convert collection to a System.Array.
public NpgsqlParameter[] ToArray()
Returns
- NpgsqlParameter[]
NpgsqlParameter[]
TryGetValue(string, out NpgsqlParameter)
Gets a value indicating whether a NpgsqlParameter with the specified parameter name exists in the collection.
public bool TryGetValue(string parameterName, out NpgsqlParameter parameter)
Parameters
parameterName
stringThe name of the NpgsqlParameter object to find.
parameter
NpgsqlParameterA reference to the requested parameter is returned in this out param if it is found in the list. This value is null if the parameter is not found.
Returns
- bool
true if the collection contains the parameter and param will contain the parameter; otherwise, false.