다음을 통해 공유


Seq.where<'T> Function (F#)

Returns a new collection containing only the elements of the collection for which the given predicate returns true.

Namespace/Module Path: Microsoft.FSharp.Collections.Seq

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

// Signature:
where : ('T -> bool) -> seq<'T> -> seq<'T>
// Usage:
Seq.where predicate source

Parameters

  • predicate
    Type: 'T -> bool

    A function to test whether each item in the input sequence should be included in the output.

  • source
    Type: seq<'T>

    The input sequence.

Exceptions

Exception

Condition

ArgumentNullException

Thrown when the input sequence is null.

Return Value

The result sequence.

Remarks

The returned sequence may be passed between threads safely. However, individual IEnumerator values generated from the returned sequence should not be accessed concurrently. Remember that sequence is subject to lazy evaluation, which means that effects are delayed until it is enumerated. This function is a synonym for Seq.filter.

This function is named Where 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: 2.0, 4.0, Portable

.0

See Also

Reference

Collections.Seq Module (F#)

Microsoft.FSharp.Collections Namespace (F#)

Seq.filter<'T> Function (F#)