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

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

Replace all items in a collection that a predicate evalues at true with a value, yielding another collection. .

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

Syntax


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

Type Parameters

T

Parameters

collection
Type: IEnumerable<(Of <(<'T>)>)>
The collection to process.
predicate
Type: Predicate<(Of <(<'T>)>)>
The predicate used to evaluate items with the collection. If the predicate returns true for a particular item, the item is replaces with replaceWith.
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.