Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions docs/conceptual/array.exactlyone['t]-function-[fsharp].md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: Array.exactlyOne<'T> Function (F#)
description: Array.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: e8315847-d65e-49c9-8cf2-450b8b395ffc
---

# Array.exactlyOne<'T> Function (F#)

Returns the only element of the array.

**Namespace/Module Path**: Microsoft.FSharp.Collections.Array

**Assembly**: FSharp.Core (in FSharp.Core.dll)


## Syntax

```fsharp
// Signature:
Array.exactlyOne : 'T [] -> 'T

// Usage:
Array.exactlyOne array
```

#### Parameters
*array*
Type: **'T**[[]](https://msdn.microsoft.com/library/def20292-9aae-4596-9275-b94e594f8493)


The input array.

## 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 array is null|


## Return Value
The last element of the array.


## 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.Array Module &#40;F&#35;&#41;](Collections.Array-Module-%5BFSharp%5D.md)

[Microsoft.FSharp.Collections Namespace &#40;F&#35;&#41;](Microsoft.FSharp.Collections-Namespace-%5BFSharp%5D.md)
1 change: 1 addition & 0 deletions docs/conceptual/collections.array-module-[fsharp].md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ For an overview of arrays in F#, see [Arrays &#40;F&#35;&#41;](Arrays-%5BFSharp%
|[`create`](https://msdn.microsoft.com/library/e848c8d6-1142-4080-9727-8dacc26066be)<br />**: int -&gt; 'T -&gt; 'T []**|Creates an array whose elements are all initially the supplied value.|
|[`distinct`](array.distinct%5B't%5D-function-%5Bfsharp%5D.md)<br />**: 'T [] -&gt; 'T []**|Returns an array that contains no duplicate entries according to generic hash and equality comparisons on the entries. If an element occurs multiple times in the array then the later occurrences are discarded.|
|[`empty`](https://msdn.microsoft.com/library/c3694b92-1c16-4c54-9bf2-fe398fadce32)<br />**: 'T []**|Returns an empty array of the given type.|
|[exactlyOne](https://msdn.microsoft.com/library/bd14fd21-b645-4416-98e4-6a6c49f3a15c)<br />**: 'T [] -&gt; 'T**|Returns the only element of the array.|
|[`exists`](https://msdn.microsoft.com/library/8e47ad6c-c065-4876-8cb4-ec960ec3e5c9)<br />**: ('T -&gt; bool) -&gt; 'T [] -&gt; bool**|Tests whether any element of an array satisfies the supplied predicate.|
|[`exists2`](https://msdn.microsoft.com/library/2e384a6a-f99d-4e23-b677-250ffbc1dd8e)<br />**: ('T1 -&gt; 'T2 -&gt; bool) -&gt; 'T1 [] -&gt; 'T2 [] -&gt; bool**|Tests whether any pair of corresponding elements of two arrays satisfy the supplied condition.|
|[`fill`](https://msdn.microsoft.com/library/c83c9886-81d9-44f9-a195-61c7b87f7df2)<br />**: 'T [] -&gt; int -&gt; int -&gt; 'T -&gt; unit**|Fills a range of elements of an array with the supplied value.|
Expand Down