FileExt.WriteText Method
Asynchronously writes text to a file location.
Namespace: UltimateXR.Extensions.System.IO
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0
Syntax
C#
public static Task WriteText(
string path,
string text,
Encoding encoding = null,
bool append = false,
CancellationToken ct = default
)
Parameters
- path
- Type: System.String
File full path to be opened for writing - text
- Type: System.String
Text to write - encoding (Optional)
- Type: System.Text.Encoding
Optional file encoding - append (Optional)
- Type: System.Boolean
Optional boolean telling whether to append or override. Default behaviour is to override. - ct (Optional)
- Type: System.Threading.CancellationToken
Optional cancellation token, to cancel the asynchronous operation
Return Value
Type: Task
Awaitable task
Exceptions
Exception | Condition |
---|---|
OperationCanceledException | Task canceled using ct |