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

Algorithms..::..Replace<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, T, T, IEqualityComparer<(Of <(<'T>)>)>)

Replace all items in a collection equal to a particular value with another values, yielding another collection. A passed IEqualityComparer is used to determine equality.

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

Syntax


public static IEnumerable<T> Replace<T>(
	IEnumerable<T> collection,
	T itemFind,
	T replaceWith,
	IEqualityComparer<T> equalityComparer
)
Public Shared Function Replace(Of T) ( _
	collection As IEnumerable(Of T), _
	itemFind As T, _
	replaceWith As T, _
	equalityComparer As IEqualityComparer(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ Replace(
	IEnumerable<T>^ collection, 
	T itemFind, 
	T replaceWith, 
	IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection
Type: IEnumerable<(Of <(<'T>)>)>
The collection 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.

Return Value

An new collection with the items from collection, in the same order, with the appropriate replacements made.