| title | List.contains<'T> Function (F#) |
|---|---|
| description | List.contains<'T> Function (F#) |
| keywords | visual f#, f#, functional programming |
| author | liboz |
| manager | danielfe |
| ms.date | 07/6/2016 |
| ms.topic | language-reference |
| ms.prod | visual-studio-dev14 |
| ms.technology | devlang-fsharp |
| ms.assetid | 52f70370-0c04-4823-bc6e-e92b60369420 |
Evaluates to true if the given element is in the input list.
Namespace/Module Path: Microsoft.FSharp.Collections.List
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature:
List.contains : 'T -> 'T list -> bool
// Usage:
List.contains element sourceelement Type: 'T
The element to find.
source Type: 'T list
The input list.
| Exception | Condition |
|---|---|
| ArgumentNullException | Thrown when the input list is null. |
Evaluates to true if the given element is in the input list. Otherwise, it will return false.
This function is named Contains in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.
The following code shows how to use List.contains.
[!code-fsharpMain]
Output
true
false
Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2
F# Core Library Versions
Supported in: 4.0, Portable