/// <summary> /// Helper method to asynchronously get value from this <see cref="AsyncDataRow"/>, and cast the value to given type. /// </summary> /// <param name="row">This <see cref="AsyncDataRow"/>.</param> /// <param name="columnLabel">The label of column holding the value.</param> /// <param name="type">The type to cast value to.</param> /// <returns>A task which will on completion contain casted value.</returns> /// <exception cref="NullReferenceException">If this <see cref="AsyncDataRow"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException">If column labeled as <paramref name="columnLabel"/> is not present in this <see cref="AsyncDataRow"/>.</exception> public static async ValueTask <Object> GetValueAsync(this AsyncDataRow row, String columnLabel, Type type) { return(await row.GetColumn(row.Metadata.GetIndexOrThrow(columnLabel)).GetValueAsync(type)); }
/// <summary> /// Helper method to asynchronously get value from this <see cref="AsyncDataRow"/>, and cast the value to given type. /// </summary> /// <param name="row">This <see cref="AsyncDataRow"/>.</param> /// <param name="index">The index of column holding the value.</param> /// <param name="type">The type to cast value to.</param> /// <returns>A task which will on completion contain casted value.</returns> /// <exception cref="NullReferenceException">If this <see cref="AsyncDataRow"/> is <c>null</c>.</exception> public static async ValueTask <Object> GetValueAsync(this AsyncDataRow row, Int32 index, Type type) { return(await row.GetColumn(index).GetValueAsync(type)); }