Aracılığıyla paylaş


Async.Ignore<'T> Yöntemi (F#)

Verilen hesaplamayı çalıştıran ve sonucunu yoksayan zaman uyumsuz bir hesaplama oluşturur.

Ad alanı/modül yolu: Microsoft.FSharp.Control

Derleme: FSharp.Core (FSharp.Core.dll),

// Signature:
static member Ignore : Async<'T> -> Async<unit>

// Usage:
Async.Ignore (computation)

Parametreler

Dönüş Değeri

Giriş hesaplamasına eşdeğer ancak sonucu yoksayan hesaplama.

Örnek

Aşağıdaki kod örneği kullanımları gösterilmektedir Async.Ignore.

open System
open System.IO

let writeToFile filename numBytes = 
    async {
        use file = File.Create(filename)
        printfn "Writing to file %s." filename
        do! file.AsyncWrite(Array.zeroCreate<byte> numBytes)
    }

let readFile filename numBytes =
    async {
        use file = File.OpenRead(filename)
        printfn "Reading from file %s." filename
        // Throw away the data being read.
        do! file.AsyncRead(numBytes) |> Async.Ignore
    }

let filename = "BigFile.dat"
let numBytes = 100000000

writeToFile filename numBytes
|> Async.RunSynchronously

readFile filename numBytes
|> Async.RunSynchronously

Platformlar

Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Sürüm Bilgisi

F# Çekirdek Kitaplığı sürümleri

Desteklenen: 2.0, 4.0, Portable

Ayrıca bkz.

Başvuru

Control.Async Sınıfı (F#)

Microsoft.FSharp.Control İsim Uzayı (F#)