diff --git a/docs/conceptual/collections.list-module-[fsharp].md b/docs/conceptual/collections.list-module-[fsharp].md index 9134deaf..10cae8d7 100644 --- a/docs/conceptual/collections.list-module-[fsharp].md +++ b/docs/conceptual/collections.list-module-[fsharp].md @@ -47,6 +47,7 @@ For an overview of lists in F#, see [Lists (F#)](Lists-%5BFSharp%5D. |[countBy](list.countby%5B't,'key%5D-function-%5Bfsharp%5D.md)
**: ('T -> 'Key) -> 'T list -> ('Key * int) list**|Applies a key-generating function to each element of a list and returns a list yielding unique keys and their number of occurrences in the original list.| |[distinct](list.distinct%5B't%5D-function-%5Bfsharp%5D.md)
**: 'T -> 'T list**|Returns a list that contains no duplicate entries according to generic hash and equality comparisons on the entries. If an element occurs multiple times in the list then the later occurrences are discarded.| |[empty](https://msdn.microsoft.com/library/bb4cb501-3429-47c1-8d5f-71180d3bded7)
**: 'T list**|Returns an empty list of the given type.| +|[exactlyOne](https://msdn.microsoft.com/library/bd14fd21-b645-4416-98e4-6a6c49f3a15c)
**: 'T list -> 'T**|Returns the only element of the list.| |[exists](https://msdn.microsoft.com/library/15a3ebd5-98f0-44c0-8220-7dedec3e68a8)
**: ('T -> bool) -> 'T list -> bool**|Tests if any element of the list satisfies the given predicate.| |[exists2](https://msdn.microsoft.com/library/7532b39e-3f4f-4534-a60b-d7721dc6fa7e)
**: ('T1 -> 'T2 -> bool) -> 'T1 list -> 'T2 list -> bool**|Tests if any pair of corresponding elements of the lists satisfies the given predicate.| |[filter](https://msdn.microsoft.com/library/11a8c926-547b-44dd-bbae-98d44f3dd248)
**: ('T -> bool) -> 'T list -> 'T list**|Returns a new collection containing only the elements of the collection for which the given predicate returns **true**.| diff --git a/docs/conceptual/list.exactlyone['t]-function-[fsharp].md b/docs/conceptual/list.exactlyone['t]-function-[fsharp].md new file mode 100644 index 00000000..425f27ae --- /dev/null +++ b/docs/conceptual/list.exactlyone['t]-function-[fsharp].md @@ -0,0 +1,66 @@ +--- +title: List.exactlyOne<'T> Function (F#) +description: List.exactlyOne<'T> Function (F#) +keywords: visual f#, f#, functional programming +author: erikschierboom +manager: danielfe +ms.date: 03/13/2017 +ms.topic: language-reference +ms.prod: visual-studio-dev14 +ms.technology: devlang-fsharp +ms.assetid: a4e46410-b7fa-4e45-8daf-f1a84b632210 +--- + +# List.exactlyOne<'T> Function (F#) + +Returns the only element of the list. + +**Namespace/Module Path**: Microsoft.FSharp.Collections.List + +**Assembly**: FSharp.Core (in FSharp.Core.dll) + + +## Syntax + +```fsharp +// Signature:exactlyOne : 'T list -> 'T + +// Usage: List.exactlyOne list +``` + +#### Parameters +*list* +Type: **'T**[list](https://msdn.microsoft.com/library/c627b668-477b-4409-91ed-06d7f1b3e4a7) + + +The input list. + +## Exceptions +|Exception|Condition| +|----|----| +|[ArgumentException](https://msdn.microsoft.com/library/system.argumentexception.aspx)|Thrown when the input does not have precisely one element.| +|[ArgumentNullException](https://msdn.microsoft.com/library/system.argumentnullexception.aspx)|Thrown when the input list is null| + + +## Return Value +The last element of the list. + + +## Remarks +This function is named `ExactlyOne` in the .NET assembly. If accessing the member from a .NET language other than F#, or through reflection, use this name. + + +## Platforms +Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2 + + +## Version Information +**F# Core Library Versions** + +Supported in: 4.0, Portable + + +## See Also +[Collections.List Module (F#)](Collections.List-Module-%5BFSharp%5D.md) + +[Microsoft.FSharp.Collections Namespace (F#)](Microsoft.FSharp.Collections-Namespace-%5BFSharp%5D.md)