MemoryExtensions.Replace Metoda

Definicja

Przeciążenia

Replace<T>(Span<T>, T, T)

Zastępuje wszystkie wystąpienia elementu oldValue .newValue

Replace<T>(ReadOnlySpan<T>, Span<T>, T, T)

Kopiuje source do destinationelementu , zastępując wszystkie wystąpienia oldValue elementu .newValue

Replace<T>(Span<T>, T, T)

Źródło:
MemoryExtensions.cs
Źródło:
MemoryExtensions.cs

Zastępuje wszystkie wystąpienia elementu oldValue .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)

Parametry typu

T

Typ elementów w zakresie.

Parametry

span
Span<T>

Zakres, w którym należy zastąpić elementy.

oldValue
T

Wartość, która ma zostać zastąpiona ciągiem newValue.

newValue
T

Wartość zastępująca wszystkie wystąpienia elementu oldValue.

Dotyczy

Replace<T>(ReadOnlySpan<T>, Span<T>, T, T)

Źródło:
MemoryExtensions.cs
Źródło:
MemoryExtensions.cs

Kopiuje source do destinationelementu , zastępując wszystkie wystąpienia oldValue elementu .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)

Parametry typu

T

Typ elementów w zakresach.

Parametry

source
ReadOnlySpan<T>

Zakres do skopiowania.

destination
Span<T>

Zakres, w którym powinny zostać zapisane skopiowane i zastąpione wartości.

oldValue
T

Wartość, która ma zostać zastąpiona ciągiem newValue.

newValue
T

Wartość zastępująca wszystkie wystąpienia elementu oldValue.

Wyjątki

Długość destination jest krótsza source niż zakres. — lub — source i destination nakładają się, ale nie odwołują się do tej samej lokalizacji początkowej.

Dotyczy