Click or drag to resize
EnumerableExtensionMethodsRandomSelectT Method (IEnumerableT, Int32, ActionT)
Executes the specified action for the specified number of random items from the specified enumerable.

Namespace: Slash.Collections.Extensions
Assembly: Slash.Collections (in Slash.Collections.dll) Version: 1.0.6018.40177
Syntax
public static void RandomSelect<T>(
	this IEnumerable<T> enumerable,
	int numberOfSelections,
	Action<T> action
)

Parameters

enumerable
Type: System.Collections.GenericIEnumerableT
Enumerable to get random items from.
numberOfSelections
Type: SystemInt32
Number of items to get from the enumerable.
action
Type: SystemActionT
Action to execute for selected items.

Type Parameters

T
Type of items in enumerable.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptionEnumerable is null.
See Also