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

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

Replace all items in a collection equal to a particular value with another values, yielding another collection.

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

Syntax


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

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.

Return Value

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

Remarks


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