-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Backsert.cs
46 lines (45 loc) · 1.82 KB
/
Backsert.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
namespace SuperLinq;
public static partial class SuperEnumerable
{
/// <summary>
/// Inserts the elements of a sequence into another sequence at a specified index from the tail of the sequence,
/// where zero always represents the last position, one represents the second-last element, two represents the
/// third-last element and so on.
/// </summary>
/// <typeparam name="T">
/// Type of elements in all sequences.
/// </typeparam>
/// <param name="first">
/// The source sequence.
/// </param>
/// <param name="second">
/// The sequence that will be inserted.
/// </param>
/// <param name="index">
/// The zero-based index from the end of <paramref name="first"/> where elements from <paramref name="second"/>
/// should be inserted. <paramref name="second"/>.
/// </param>
/// <returns>
/// A sequence that contains the elements of <paramref name="first"/> plus the elements of <paramref
/// name="second"/> inserted at the given index from the end of <paramref name="first"/>.
/// </returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="first" /> or <paramref name="second" /> is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="index"/> is negative.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">
/// Thrown lazily if <paramref name="index"/> is greater than the length of <paramref name="first"/>.
/// </exception>
/// <remarks>
/// <para>
/// This operator uses deferred execution and streams its results.
/// </para>
/// </remarks>
[Obsolete("Backsert has been replaced by Insert(second, Index index)")]
public static IEnumerable<T> Backsert<T>(this IEnumerable<T> first, IEnumerable<T> second, int index)
{
return first.Insert(second, ^index);
}
}