Method
LogStream.SafeAppendToFile
SafeAppendToFile(string, string?) #
Safely appends the specified string to the specified file path.
public static bool SafeAppendToFile(string filePath, string? text)Parameters #
filePath string
The path to the file where the string will be appended.
text string?
The string to append to the file. Can be null.
Returns #
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.
SafeAppendToFile(string, string?, Encoding) #
Safely appends the specified string to the specified file path.
public static bool SafeAppendToFile(string filePath, string? text, Encoding encoding)Parameters #
filePath string
The path to the file where the string will be appended.
text string?
The string to append to the file. Can be null.
encoding Encoding
The encoding to use when appending the string.
Returns #
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.
SafeAppendToFile(string, string[]) #
Safely appends the specified lines to the specified file path.
public static bool SafeAppendToFile(string filePath, string[] lines)Parameters #
filePath string
The path to the file where the lines will be appended.
lines string[]
The lines to append to the file.
Returns #
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.
SafeAppendToFile(string, string[], Encoding) #
Safely appends the specified lines to the specified file path.
public static bool SafeAppendToFile(string filePath, string[] lines, Encoding encoding)Parameters #
filePath string
The path to the file where the lines will be appended.
lines string[]
The lines to append to the file.
encoding Encoding
The encoding to use when appending the lines.
Returns #
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.