| title | Option.filter<'T> Function (F#) |
|---|---|
| description | Option.filter<'T> Function (F#) |
| keywords | visual f#, f#, functional programming |
| author | eriawan |
| manager | danielfe |
| ms.date | 07/01/2016 |
| ms.topic | language-reference |
| ms.prod | visual-studio-dev14 |
| ms.technology | devlang-fsharp |
| ms.assetid | ff36174c-0820-47e4-b7ce-6fa93f19bcb5 |
Evaluates whether the value contained in the option should remain, or be filtered out.
Namespace/Module Path: Microsoft.FSharp.Core.Option
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature:
filter : ('T -> bool) -> option:'T option -> 'T option
// Usage:
filter predicate optionpredicate Type: 'T ->bool
A function that evaluates whether the value contained in the option should remain, or be filtered out.
option Type: 'T option
The input option.
The input option if it has a value and the predicate evaluates to true for this value; otherwise, None.
The expression Option.filter f inp evaluates to match inp with Some x when f x -> inp | _ -> None.
This function is named Filter in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.
Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2
F# Core Library Versions
Supported in: 4.0, Portable