Method WriteLines
WriteLines(ILogWriter, IEnumerable<string>)
Writes each string in the specified collection to the log, appending a new line after each entry.
public static ILogWriter WriteLines(this ILogWriter writer, IEnumerable<string> lines)
Parameters
writerILogWriterThe log writer to which the lines will be written. Cannot be null.
linesIEnumerable<string>The collection of strings to write to the log. Cannot be null.
Returns
- ILogWriter
The same ILogWriter instance that was provided, to support method chaining.
Remarks
This method writes each string in lines to the log by calling WriteLine(string) for each element. The order of the lines is preserved.
WriteLines(ILogWriter, IEnumerable)
Writes each item in the specified collection to the log as a separate line.
public static ILogWriter WriteLines(this ILogWriter writer, IEnumerable lines)
Parameters
writerILogWriterThe log writer to which the lines will be written. Cannot be null.
linesIEnumerableThe collection of items to write. Each item is converted to a string and written as a separate line. Cannot be null.
Returns
- ILogWriter
The same ILogWriter instance that was provided, to support method chaining.
Remarks
If an item in lines is null, an empty line is written for that
item. This method enables fluent-style logging by returning the original writer.
WriteLines(ILogWriter, params string[])
Writes each string in the specified collection to the log as a separate line.
public static ILogWriter WriteLines(this ILogWriter writer, params string[] lines)
Parameters
writerILogWriterThe log writer to which the lines will be written. Cannot be null.
linesstring[]An array of strings to write to the log. Each string is written as a separate line. Cannot be null.
Returns
- ILogWriter
The same ILogWriter instance that was provided, to support method chaining.
Remarks
This method is an extension method for ILogWriter and allows writing
multiple lines in a single call. If the lines array is empty, no lines are
written.
WriteLines(ILogWriter, params object?[])
Writes each specified line to the log using the provided writer.
public static ILogWriter WriteLines(this ILogWriter writer, params object?[] lines)
Parameters
writerILogWriterThe log writer to which the lines will be written. Cannot be null.
linesobject[]An array of objects to write as individual lines. Each object is converted to its string representation. Null values are written as empty lines.
Returns
- ILogWriter
The same ILogWriter instance that was provided, to support method chaining.
Remarks
This method is an extension method that allows writing multiple lines to the log in a single call. It is useful for fluent logging scenarios.