ExtraTopLevelOperators.eprintf<'T>-Funktion (F#)
Druckt in stderr mit dem angegebenen Format.
Namespace/Modulpfad: Microsoft.FSharp.Core.ExtraTopLevelOperators
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature:
eprintf : TextWriterFormat<'T> -> 'T
// Usage:
eprintf format
Parameter
- format
Typ: TextWriterFormat<'T>
Hinweise
Der Name dieser Funktion in kompilierten Assemblys lautet PrintFormatToError. Verwenden Sie diesen Namen, wenn Sie in einer anderen .NET-Sprache als F# oder durch Reflektion auf die Funktion zugreifen.
Beispiel
Im folgenden Codebeispiel wird die Verwendung von eprintf veranschaulicht.
let maxValue = 10
let function1 x =
if (x > maxValue) then
eprintf "Error: the input %d exceeds the maximum value, %d." x maxValue
else
printfn "Success!"
function1 1
function1 11
// Issue a newline to stderr to trigger printing.
stderr.WriteLine()
Die Ausgabe lautet wie folgt.
Plattformen
Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2
Versionsinformationen
F#-Kern-Bibliotheks-Versionen
Unterstützt in: 2.0, 4.0