[This is preliminary documentation and is subject to change.]
Gets value indicating if collection contains exactly one element
Namespace: Tools.LinqTAssembly: Tools (in Tools.dll) Version: 1.5.3.38916 (1.5.3.38916)
Syntax
| C# |
|---|
public static bool Single( this IEnumerable collection ) |
| Visual Basic |
|---|
<ExtensionAttribute> _ Public Shared Function Single ( _ collection As IEnumerable _ ) As Boolean |
| Visual C++ |
|---|
[ExtensionAttribute] public: static bool Single( IEnumerable^ collection ) |
| F# |
|---|
static member Single : collection:IEnumerable -> bool |
| JScript |
|---|
public static function Single( collection : IEnumerable ) : boolean |
Parameters
- collection
- Type: System.Collections..::..IEnumerable
Collection to check
Return Value
True if collection contains exactly one elementUsage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Exceptions
| Exception | Condition |
|---|---|
| System..::..ArgumentNullException | collection is null |
See Also
Version History
1.5.3
- This function is new in version 1.5.3