Click or drag to resize

EnumerableExtensionsGetRandomT Method

Returns a random item from the objects in the collection

Namespace:  TestHelperExtensions
Assembly:  CBI.TestHelperExtensions (in CBI.TestHelperExtensions.dll) Version: 2.1.0.1
Syntax
public static T GetRandom<T>(
	this IEnumerable<T> values
)

Parameters

values
Type: System.Collections.GenericIEnumerableT
A list of items from which a random one is to be selected.

Type Parameters

T
Any collectable type

Return Value

Type: T
A random object from within the list of values

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).
See Also