You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Extensions/Span/SpanExtensions.Linq.cs
+57-12Lines changed: 57 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -220,6 +220,51 @@ public static Span<T> Take<T>(this Span<T> source, int count)
220
220
{
221
221
returnsource[..count];
222
222
}
223
+
/// <summary>
224
+
/// Bypasses elements in <paramref name="source"/> as long as a <paramref name="condition"/> is true and then returns the remaining elements. The element's index is used in the logic of the predicate function.
225
+
/// </summary>
226
+
/// <typeparam name="T">The type of elements in the <see cref="ReadOnlySpan{T}"/>.</typeparam>
227
+
/// <param name="source">The <see cref="ReadOnlySpan{T}"/> to operate on.</param>
228
+
/// <param name="condition">A function to test each element for a condition.</param>
229
+
/// <returns>A <see cref="ReadOnlySpan{T}"/> that contains the elements from <paramref name="source"/> starting at the first element in the linear series that does not pass the specified <paramref name="condition" />.</returns>
230
+
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="condition"/> is null.</exception>
/// Returns elements from <paramref name="source"/> as long as a specified <paramref name="condition"/> is true, and then skips the remaining elements.
248
+
/// </summary>
249
+
/// <typeparam name="T">The type of elements in the <see cref="ReadOnlySpan{T}"/>.</typeparam>
250
+
/// <param name="source">The <see cref="ReadOnlySpan{T}"/> to operate on.</param>
251
+
/// <param name="condition">A function to test each element for a condition.</param>
252
+
/// <returns>A <see cref="ReadOnlySpan{T}"/> that contains elements from <paramref name="source"/> that occur before the element at which the <paramref name="condition"/> no longer passes.</returns>
253
+
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="condition"/> is null.</exception>
/// Returns a new <see cref="Span{T}"/> that contains the elements from source with the last <paramref name="count"/> elements of the source collection omitted.
@@ -287,7 +332,7 @@ public static Half Average(this Span<Half> source)
287
332
/// <summary>
288
333
/// Computes the Average of all the values in <paramref name="source"/>.
289
334
/// </summary>
290
-
/// <param name="source">The <see cref="ReadOnlySpan{Byte}"/> to operate on.</param>
335
+
/// <param name="source">The <see cref="Span{Byte}"/> to operate on.</param>
291
336
/// <returns>The Average of all the values in <paramref name="source"/>.</returns>
292
337
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
293
338
publicstaticbyteAverage(thisSpan<byte>source)
@@ -298,7 +343,7 @@ public static byte Average(this Span<byte> source)
298
343
/// <summary>
299
344
/// Computes the Average of all the values in <paramref name="source"/>.
300
345
/// </summary>
301
-
/// <param name="source">The <see cref="ReadOnlySpan{UInt16}"/> to operate on.</param>
346
+
/// <param name="source">The <see cref="Span{UInt16}"/> to operate on.</param>
302
347
/// <returns>The Average of all the values in <paramref name="source"/>.</returns>
303
348
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
304
349
publicstaticushortAverage(thisSpan<ushort>source)
@@ -309,7 +354,7 @@ public static ushort Average(this Span<ushort> source)
309
354
/// <summary>
310
355
/// Computes the Average of all the values in <paramref name="source"/>.
311
356
/// </summary>
312
-
/// <param name="source">The <see cref="ReadOnlySpan{uint32}"/> to operate on.</param>
357
+
/// <param name="source">The <see cref="Span{uint32}"/> to operate on.</param>
313
358
/// <returns>The Average of all the values in <paramref name="source"/>.</returns>
314
359
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
315
360
publicstaticuintAverage(thisSpan<uint>source)
@@ -319,7 +364,7 @@ public static uint Average(this Span<uint> source)
319
364
/// <summary>
320
365
/// Computes the Average of all the values in <paramref name="source"/>.
321
366
/// </summary>
322
-
/// <param name="source">The <see cref="ReadOnlySpan{UInt64}"/> to operate on.</param>
367
+
/// <param name="source">The <see cref="Span{UInt64}"/> to operate on.</param>
323
368
/// <returns>The Average of all the values in <paramref name="source"/>.</returns>
324
369
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
325
370
publicstaticulongAverage(thisSpan<ulong>source)
@@ -330,7 +375,7 @@ public static ulong Average(this Span<ulong> source)
330
375
/// <summary>
331
376
/// Computes the Average of all the values in <paramref name="source"/>.
332
377
/// </summary>
333
-
/// <param name="source">The <see cref="ReadOnlySpan{SByte}"/> to operate on.</param>
378
+
/// <param name="source">The <see cref="Span{SByte}"/> to operate on.</param>
334
379
/// <returns>The Average of all the values in <paramref name="source"/>.</returns>
335
380
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
336
381
publicstaticsbyteAverage(thisSpan<sbyte>source)
@@ -341,7 +386,7 @@ public static sbyte Average(this Span<sbyte> source)
341
386
/// <summary>
342
387
/// Computes the Average of all the values in <paramref name="source"/>.
343
388
/// </summary>
344
-
/// <param name="source">The <see cref="ReadOnlySpan{Int16}"/> to operate on.</param>
389
+
/// <param name="source">The <see cref="Span{Int16}"/> to operate on.</param>
345
390
/// <returns>The Average of all the values in <paramref name="source"/>.</returns>
346
391
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
347
392
publicstaticshortAverage(thisSpan<short>source)
@@ -352,7 +397,7 @@ public static short Average(this Span<short> source)
352
397
/// <summary>
353
398
/// Computes the Average of all the values in <paramref name="source"/>.
354
399
/// </summary>
355
-
/// <param name="source">The <see cref="ReadOnlySpan{Int32}"/> to operate on.</param>
400
+
/// <param name="source">The <see cref="Span{Int32}"/> to operate on.</param>
356
401
/// <returns>The Average of all the values in <paramref name="source"/>.</returns>
357
402
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
358
403
publicstaticintAverage(thisSpan<int>source)
@@ -363,7 +408,7 @@ public static int Average(this Span<int> source)
363
408
/// <summary>
364
409
/// Computes the Average of all the values in <paramref name="source"/>.
365
410
/// </summary>
366
-
/// <param name="source">The <see cref="ReadOnlySpan{Int64}"/> to operate on.</param>
411
+
/// <param name="source">The <see cref="Span{Int64}"/> to operate on.</param>
367
412
/// <returns>The Average of all the values in <paramref name="source"/>.</returns>
368
413
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
369
414
publicstaticlongAverage(thisSpan<long>source)
@@ -374,7 +419,7 @@ public static long Average(this Span<long> source)
374
419
/// <summary>
375
420
/// Computes the Average of all the values in <paramref name="source"/>.
376
421
/// </summary>
377
-
/// <param name="source">The <see cref="ReadOnlySpan{Single}"/> to operate on.</param>
422
+
/// <param name="source">The <see cref="Span{Single}"/> to operate on.</param>
378
423
/// <returns>The Average of all the values in <paramref name="source"/>.</returns>
379
424
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
380
425
publicstaticfloatAverage(thisSpan<float>source)
@@ -385,7 +430,7 @@ public static float Average(this Span<float> source)
385
430
/// <summary>
386
431
/// Computes the Average of all the values in <paramref name="source"/>.
387
432
/// </summary>
388
-
/// <param name="source">The <see cref="ReadOnlySpan{Double}"/> to operate on.</param>
433
+
/// <param name="source">The <see cref="Span{Double}"/> to operate on.</param>
389
434
/// <returns>The Average of all the values in <paramref name="source"/>.</returns>
390
435
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
391
436
publicstaticdoubleAverage(thisSpan<double>source)
@@ -396,7 +441,7 @@ public static double Average(this Span<double> source)
396
441
/// <summary>
397
442
/// Computes the Average of all the values in <paramref name="source"/>.
398
443
/// </summary>
399
-
/// <param name="source">The <see cref="ReadOnlySpan{Int64}"/> to operate on.</param>
444
+
/// <param name="source">The <see cref="Span{Decimal}"/> to operate on.</param>
400
445
/// <returns>The Average of all the values in <paramref name="source"/>.</returns>
401
446
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
0 commit comments