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

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

Replace all items in a list or array equal to a particular value with another value. The replacement is done in-place, changing the list.

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

Syntax


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

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.

Remarks


The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

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