Table of Contents

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

record IDataRecord

The record to read the values from.

ordinals ReadOnlySpan<int>

The ordinals to read.

values Span<object>

The span that receives the values. It must be at least as long as ordinals.

Returns

Span<object>

The provided span, updated with values matching the ordinal positions requested.

Exceptions

ArgumentNullException

record is null.

IndexOutOfRangeException

values is shorter than ordinals, 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

record IDataRecord

The record to read the values from.

ordinals IReadOnlyList<int>

The ordinals to read.

values TList

The 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

TList

The type of the list that receives the values.

Exceptions

ArgumentNullException

record or ordinals is 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

record IDataRecord

The record to read the values from.

ordinals IReadOnlyList<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 ordinals is empty.

Exceptions

ArgumentNullException

record or ordinals is null.

IndexOutOfRangeException

An ordinal is not a valid column index for the record.