Wintellect.PowerCollections Namespace
Algorithms Class
Algorithms Methods
GhostDoc Pro Sample Help File

Algorithms..::..ReplaceInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T, T, IEqualityComparer<(Of <(<'T>)>)>)

Replace all items in a list or array equal to a particular value with another values. The replacement is done in-place, changing the list. A passed IEqualityComparer is used to determine equality.

Namespace:  Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax


public static void ReplaceInPlace<T>(
	IList<T> list,
	T itemFind,
	T replaceWith,
	IEqualityComparer<T> equalityComparer
)
Public Shared Sub ReplaceInPlace(Of T) ( _
	list As IList(Of T), _
	itemFind As T, _
	replaceWith As T, _
	equalityComparer As IEqualityComparer(Of T) _
)
public:
generic<typename T>
static void ReplaceInPlace(
	IList<T>^ list, 
	T itemFind, 
	T replaceWith, 
	IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

list
Type: IList<(Of <(<'T>)>)>
The list or array to process.
itemFind
Type: T
The value to find and replace within collection.
replaceWith
Type: T
The new value to replace with.
equalityComparer
Type: IEqualityComparer<(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals method will be called.

Remarks


Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.