Skip to content

Commit 51e7d00

Browse files
committed
refactor: remove zombie Span.Replace
1 parent 02ab7dc commit 51e7d00

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

X10D/src/Collections/SpanExtensions.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,6 @@ public static ReadOnlySpan<T> AsReadOnly<T>(this in Span<T> source)
1616
return source;
1717
}
1818

19-
#if !NET8_0_OR_GREATER
20-
/// <summary>
21-
/// Replaces all occurrences of a specified element in a span of elements with another specified element.
22-
/// </summary>
23-
/// <param name="haystack">The source span.</param>
24-
/// <param name="needle">The element to replace.</param>
25-
/// <param name="replacement">The replacement element.</param>
26-
/// <typeparam name="T">The type of elements in <paramref name="haystack" />.</typeparam>
27-
public static void Replace<T>(this Span<T> haystack, T needle, T replacement) where T : struct
28-
{
29-
var comparer = EqualityComparer<T>.Default;
30-
31-
for (var index = 0; index < haystack.Length; index++)
32-
{
33-
if (comparer.Equals(haystack[index], needle))
34-
{
35-
haystack[index] = replacement;
36-
}
37-
}
38-
}
39-
#endif
40-
4119
#if !NET9_0_OR_GREATER
4220
/// <summary>
4321
/// Splits a span of elements into sub-spans based on a delimiting element.

0 commit comments

Comments
 (0)