Sisk

Method

LogStream.SafeWriteToFile

Namespace
Sisk.Core.Http
Assembly
Sisk.Core.dll

SafeWriteToFile(string, string?) #

Safely writes the specified string to the specified file path.

C#
public static bool SafeWriteToFile(string filePath, string? contents)

Parameters #

filePath string

The path to the file where the string will be written.

contents string?

The string to write to the file. Can be null.

Returns #

bool

true if the operation was successful, otherwise false.

Remarks #

Calls to these file helper methods for the same normalized full path are serialized within the current process. Synchronous and asynchronous overloads share the same per-file lock, while calls for different files can run concurrently. Access is not coordinated across processes.

SafeWriteToFile(string, string?, Encoding) #

Safely writes the specified string to the specified file path.

C#
public static bool SafeWriteToFile(string filePath, string? contents, Encoding encoding)

Parameters #

filePath string

The path to the file where the string will be written.

contents string?

The string to write to the file. Can be null.

encoding Encoding

The encoding to use when writing the string. Defaults to Default.

Returns #

bool

true if the operation was successful, otherwise false.

Remarks #

Calls to these file helper methods for the same normalized full path are serialized within the current process. Synchronous and asynchronous overloads share the same per-file lock, while calls for different files can run concurrently. Access is not coordinated across processes.

SafeWriteToFile(string, string[]) #

Safely writes the specified lines to the specified file path.

C#
public static bool SafeWriteToFile(string filePath, string[] lines)

Parameters #

filePath string

The path to the file where the lines will be written.

lines string[]

The lines to write to the file.

Returns #

bool

true if the operation was successful, otherwise false.

Remarks #

Calls to these file helper methods for the same normalized full path are serialized within the current process. Synchronous and asynchronous overloads share the same per-file lock, while calls for different files can run concurrently. Access is not coordinated across processes.

SafeWriteToFile(string, string[], Encoding) #

Safely writes the specified lines to the specified file path.

C#
public static bool SafeWriteToFile(string filePath, string[] lines, Encoding encoding)

Parameters #

filePath string

The path to the file where the lines will be written.

lines string[]

The lines to write to the file.

encoding Encoding

The encoding to use when writing the lines.

Returns #

bool

true if the operation was successful, otherwise false.

Remarks #

Calls to these file helper methods for the same normalized full path are serialized within the current process. Synchronous and asynchronous overloads share the same per-file lock, while calls for different files can run concurrently. Access is not coordinated across processes.

Type to search the documentation and the API reference.