 | 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
Syntaxpublic static T GetRandom<T>(
this IEnumerable<T> values
)
<ExtensionAttribute>
Public Shared Function GetRandom(Of T) (
values As IEnumerable(Of T)
) As T
public:
[ExtensionAttribute]
generic<typename T>
static T GetRandom(
IEnumerable<T>^ values
)
[<ExtensionAttribute>]
static member GetRandom :
values : IEnumerable<'T> -> 'T
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:
TA 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