コード例 #1
0
 /// <summary>
 /// Asynchronously retrieves 2 subsequent values from this <see cref="AsyncDataRow"/> and transforms them into a <see cref="ValueTuple{T1,T2}"/>.
 /// </summary>
 /// <typeparam name="T1">The type of the first value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T2">The type of the second value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <param name="row">This <see cref="AsyncDataRow"/>.</param>
 /// <param name="startIndex">The index at which to get the first value. The second value is retrieved from subsequent index (<paramref name="startIndex"/> + 1).</param>
 /// <returns>Potentially asynchronously returns a <see cref="ValueTuple{T1,T2}"/> containing the retrieved value.</returns>
 /// <exception cref="NullReferenceException">If this <see cref="AsyncDataRow"/> is <c>null</c>.</exception>
 /// <exception cref="ArgumentException">If any of the value indices is out of range for this <see cref="AsyncDataRow"/>.</exception>
 public static async ValueTask <ValueTuple <T1, T2> > TransformToTuple <T1, T2>(this AsyncDataRow row, Int32 startIndex = 0)
 {
     return(
         await row.GetValueAsync <T1>(startIndex),
         await row.GetValueAsync <T2>(startIndex + 1)
         );
 }
コード例 #2
0
 /// <summary>
 /// Asynchronously retrieves 8 or more subsequent values from this <see cref="AsyncDataRow"/> and transforms them into a <see cref="ValueTuple{T1,T2,T3,T4,T5,T6,T7,TRest}"/>.
 /// </summary>
 /// <typeparam name="T1">The type of the first value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T2">The type of the second value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T3">The type of the third value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T4">The type of the fourth value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T5">The type of the fifth value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T6">The type of the sixth value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T7">The type of the seventh value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="TRest">The type of the rest of the values to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <param name="row">This <see cref="AsyncDataRow"/>.</param>
 /// <param name="startIndex">The index at which to get the first value. The rest of the values are retrieved from subsequent indices.</param>
 /// <returns>Potentially asynchronously returns a <see cref="ValueTuple{T1,T2,T3,T4,T5,T6,T7,TRest}"/> containing the retrieved value.</returns>
 /// <exception cref="NullReferenceException">If this <see cref="AsyncDataRow"/> is <c>null</c>.</exception>
 /// <exception cref="ArgumentException">If any of the value indices is out of range for this <see cref="AsyncDataRow"/>.</exception>
 public static async ValueTask <ValueTuple <T1, T2, T3, T4, T5, T6, T7, TRest> > TransformToTuple <T1, T2, T3, T4, T5, T6, T7, TRest>(this AsyncDataRow row, Int32 startIndex = 0)
     where TRest : struct
 {
     return(new ValueTuple <T1, T2, T3, T4, T5, T6, T7, TRest>(
                await row.GetValueAsync <T1>(startIndex),
                await row.GetValueAsync <T2>(startIndex + 1),
                await row.GetValueAsync <T3>(startIndex + 2),
                await row.GetValueAsync <T4>(startIndex + 3),
                await row.GetValueAsync <T5>(startIndex + 4),
                await row.GetValueAsync <T6>(startIndex + 5),
                await row.GetValueAsync <T7>(startIndex + 6),
                await row.GetValueAsync <TRest>(startIndex + 7)
                ));
 }
コード例 #3
0
 /// <summary>
 /// Asynchronously retrieves 6 subsequent values from this <see cref="AsyncDataRow"/> and transforms them into a <see cref="ValueTuple{T1,T2,T3,T4,T5,T6}"/>.
 /// </summary>
 /// <typeparam name="T1">The type of the first value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T2">The type of the second value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T3">The type of the third value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T4">The type of the fourth value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T5">The type of the fifth value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <typeparam name="T6">The type of the sixth value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <param name="row">This <see cref="AsyncDataRow"/>.</param>
 /// <param name="startIndex">The index at which to get the first value. The rest of the values are retrieved from subsequent indices.</param>
 /// <returns>Potentially asynchronously returns a <see cref="ValueTuple{T1,T2,T3,T4,T5,T6}"/> containing the retrieved value.</returns>
 /// <exception cref="NullReferenceException">If this <see cref="AsyncDataRow"/> is <c>null</c>.</exception>
 /// <exception cref="ArgumentException">If any of the value indices is out of range for this <see cref="AsyncDataRow"/>.</exception>
 public static async ValueTask <ValueTuple <T1, T2, T3, T4, T5, T6> > TransformToTuple <T1, T2, T3, T4, T5, T6>(this AsyncDataRow row, Int32 startIndex = 0)
 {
     return(
         await row.GetValueAsync <T1>(startIndex),
         await row.GetValueAsync <T2>(startIndex + 1),
         await row.GetValueAsync <T3>(startIndex + 2),
         await row.GetValueAsync <T4>(startIndex + 3),
         await row.GetValueAsync <T5>(startIndex + 4),
         await row.GetValueAsync <T6>(startIndex + 5)
         );
 }
コード例 #4
0
 /// <summary>
 /// Helper method to asynchronously get value as is from this <see cref="AsyncDataRow"/>, and the value as <see cref="Object"/>.
 /// </summary>
 /// <param name="row">This <see cref="AsyncDataRow"/>.</param>
 /// <param name="columnLabel">The label of column holding the value.</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> GetValueAsObjectAsync(this AsyncDataRow row, String columnLabel)
 {
     return(await row.GetValueAsync(row.Metadata.GetIndexOrThrow(columnLabel), typeof(Object)));
 }
コード例 #5
0
 /// <summary>
 /// Asynchronously retrieves 1 value from this <see cref="AsyncDataRow"/> and transforms it into a <see cref="ValueTuple{T1}"/>.
 /// </summary>
 /// <typeparam name="T1">The type of the value to get from this <see cref="AsyncDataRow"/>.</typeparam>
 /// <param name="row">This <see cref="AsyncDataRow"/>.</param>
 /// <param name="index">The index at which to get the value.</param>
 /// <returns>Potentially asynchronously returns a <see cref="ValueTuple{T1}"/> containing the retrieved value.</returns>
 /// <exception cref="NullReferenceException">If this <see cref="AsyncDataRow"/> is <c>null</c>.</exception>
 /// <exception cref="ArgumentException">If the <paramref name="index"/> is out of range for this <see cref="AsyncDataRow"/>.</exception>
 public static async ValueTask <ValueTuple <T1> > TransformToTuple <T1>(this AsyncDataRow row, Int32 index = 0)
 {
     return(new ValueTuple <T1>(await row.GetValueAsync <T1>(index)));
 }
コード例 #6
0
 /// <summary>
 /// Helper method to asynchronously get value from this <see cref="AsyncDataRow"/>, and cast the value to given type., which is known at compile time.
 /// </summary>
 /// <typeparam name="T">The type to cast value to.</typeparam>
 /// <param name="row">This <see cref="AsyncDataRow"/>.</param>
 /// <param name="columnLabel">The label of column holding the value.</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 <T> GetValueAsync <T>(this AsyncDataRow row, String columnLabel)
 {
     return((T)(await row.GetValueAsync(row.Metadata.GetIndexOrThrow(columnLabel), typeof(T))));
 }
コード例 #7
0
 /// <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));
 }
コード例 #8
0
 /// <summary>
 /// Helper method to asynchronously get value as is from this <see cref="AsyncDataRow"/>, and the value as <see cref="Object"/>.
 /// </summary>
 /// <param name="row">This <see cref="AsyncDataRow"/>.</param>
 /// <param name="index">The index of column holding the value.</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> GetValueAsObjectAsync(this AsyncDataRow row, Int32 index)
 {
     return(await row.GetValueAsync(index, typeof(Object)));
 }
コード例 #9
0
 /// <summary>
 /// Helper method to asynchronously get value from this <see cref="AsyncDataRow"/>, and cast the value to given type., which is known at compile time.
 /// </summary>
 /// <typeparam name="T">The type to cast value to.</typeparam>
 /// <param name="row">This <see cref="AsyncDataRow"/>.</param>
 /// <param name="index">The index of column holding the value.</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 <T> GetValueAsync <T>(this AsyncDataRow row, Int32 index)
 {
     return((T)(await row.GetValueAsync(index, typeof(T))));
 }
コード例 #10
0
 /// <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));
 }