Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Replace<T>(Span<T>, T, T, IEqualityComparer<T>) | |
Replace<T>(ReadOnlySpan<T>, Span<T>, T, T, IEqualityComparer<T>) | |
Replace<T>(Span<T>, T, T) |
Replaces all occurrences of |
Replace<T>(ReadOnlySpan<T>, Span<T>, T, T) |
Copies |
public static void Replace<T>(this Span<T> span, T oldValue, T newValue, System.Collections.Generic.IEqualityComparer<T>? comparer = default);
static member Replace : Span<'T> * 'T * 'T * System.Collections.Generic.IEqualityComparer<'T> -> unit
<Extension()>
Public Sub Replace(Of T) (span As Span(Of T), oldValue As T, newValue As T, Optional comparer As IEqualityComparer(Of T) = Nothing)
Product | Versions |
---|---|
.NET | 10 |
public static void Replace<T>(this ReadOnlySpan<T> source, Span<T> destination, T oldValue, T newValue, System.Collections.Generic.IEqualityComparer<T>? comparer = default);
static member Replace : ReadOnlySpan<'T> * Span<'T> * 'T * 'T * System.Collections.Generic.IEqualityComparer<'T> -> unit
<Extension()>
Public Sub Replace(Of T) (source As ReadOnlySpan(Of T), destination As Span(Of T), oldValue As T, newValue As T, Optional comparer As IEqualityComparer(Of T) = Nothing)
Product | Versions |
---|---|
.NET | 10 |
Replaces all occurrences of oldValue
with newValue
.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static void Replace(Span<T> span, T oldValue, T newValue);
public static void Replace<T>(this Span<T> span, T oldValue, T newValue) where T : IEquatable<T>;
static member Replace : Span<'T (requires 'T :> IEquatable<'T>)> * 'T * 'T -> unit (requires 'T :> IEquatable<'T>)
<Extension()>
Public Sub Replace(Of T As IEquatable(Of T)) (span As Span(Of T), oldValue As T, newValue As T)
The type of the elements in the span.
The span in which the elements should be replaced.
The value to be replaced with newValue
.
The value to replace all occurrences of oldValue
.
Product | Versions |
---|---|
.NET | 8, 9, 10 |
Copies source
to destination
, replacing all occurrences of oldValue
with newValue
.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static void Replace(ReadOnlySpan<T> source, Span<T> destination, T oldValue, T newValue);
public static void Replace<T>(this ReadOnlySpan<T> source, Span<T> destination, T oldValue, T newValue) where T : IEquatable<T>;
static member Replace : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * Span<'T (requires 'T :> IEquatable<'T>)> * 'T * 'T -> unit (requires 'T :> IEquatable<'T>)
<Extension()>
Public Sub Replace(Of T As IEquatable(Of T)) (source As ReadOnlySpan(Of T), destination As Span(Of T), oldValue As T, newValue As T)
The type of the elements in the spans.
The span to copy.
The span into which the copied and replaced values should be written.
The value to be replaced with newValue
.
The value to replace all occurrences of oldValue
.
The destination
span is shorter than the source
span.
-or-
source
and destination
overlap but don't refer to the same starting location.
Product | Versions |
---|---|
.NET | 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in