Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Latest commit

 

History

History
81 lines (54 loc) · 1.79 KB

File metadata and controls

81 lines (54 loc) · 1.79 KB
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

List.contains<'T> Function (F#)

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)

Syntax

// Signature:
List.contains : 'T -> 'T list -> bool

// Usage:
List.contains element source

Parameters

element Type: 'T

The element to find.

source Type: 'T list

The input list.

Exceptions

Exception Condition
ArgumentNullException Thrown when the input list is null.

Return Value

Evaluates to true if the given element is in the input list. Otherwise, it will return false.

Remarks

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.

Example

The following code shows how to use List.contains.

[!code-fsharpMain]

Output

true
false

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#)

Microsoft.FSharp.Collections Namespace (F#)