 | EnumerableExtensionMethodsRandomSelectT Method (IEnumerableT) |
Selects a random item from the specified enumerable.
Namespace: Slash.Collections.ExtensionsAssembly: Slash.Collections (in Slash.Collections.dll) Version: 1.0.6018.40177
Syntaxpublic static T RandomSelect<T>(
this IEnumerable<T> enumerable
)
<ExtensionAttribute>
Public Shared Function RandomSelect(Of T) (
enumerable As IEnumerable(Of T)
) As T
public:
[ExtensionAttribute]
generic<typename T>
static T RandomSelect(
IEnumerable<T>^ enumerable
)
[<ExtensionAttribute>]
static member RandomSelect :
enumerable : IEnumerable<'T> -> 'T
Parameters
- enumerable
- Type: System.Collections.GenericIEnumerableT
Enumerable to get random item from.
Type Parameters
- T
- Type of items in enumerable.
Return Value
Type:
T Random item from specified 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
See Also