Method GetValuesFromOrdinals
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
GetValuesFromOrdinals(IDataRecord, ReadOnlySpan<int>, Span<object>)
Reads the values of the columns at the specified ordinals into the provided span.
public static Span<object> GetValuesFromOrdinals(this IDataRecord record, ReadOnlySpan<int> ordinals, Span<object> values)
Parameters
recordIDataRecordThe record to read the values from.
ordinalsReadOnlySpan<int>The ordinals to read.
valuesSpan<object>The span that receives the values. It must be at least as long as
ordinals.
Returns
Exceptions
- ArgumentNullException
recordis null.- IndexOutOfRangeException
valuesis shorter thanordinals, or an ordinal is not a valid column index for the record.
GetValuesFromOrdinals<TList>(IDataRecord, IReadOnlyList<int>, TList)
Reads the values of the columns at the specified ordinals into the provided list.
public static TList GetValuesFromOrdinals<TList>(this IDataRecord record, IReadOnlyList<int> ordinals, TList values) where TList : IList<object>
Parameters
recordIDataRecordThe record to read the values from.
ordinalsIReadOnlyList<int>The ordinals to read.
valuesTListThe list that receives the values. It must already have at least as many elements as
ordinals.
Returns
- TList
The provided list, updated with values matching the ordinal positions requested.
Type Parameters
TListThe type of the list that receives the values.
Exceptions
- ArgumentNullException
recordorordinalsis null.
GetValuesFromOrdinals(IDataRecord, IReadOnlyList<int>)
Reads the values of the columns at the specified ordinals into a new array.
public static object[] GetValuesFromOrdinals(this IDataRecord record, IReadOnlyList<int> ordinals)
Parameters
recordIDataRecordThe record to read the values from.
ordinalsIReadOnlyList<int>The ordinals to read. The values are returned in this order.
Returns
- object[]
A new array of values matching the ordinal positions requested. It is empty if
ordinalsis empty.
Exceptions
- ArgumentNullException
recordorordinalsis null.- IndexOutOfRangeException
An ordinal is not a valid column index for the record.