Method AppendJoin
AppendJoin(StringBuilder, String, String[])
Appends all the strings in parts to builder placing separator between each part.
Declaration
public static StringBuilder AppendJoin(this StringBuilder builder, string separator, params string[] parts)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Text.StringBuilder | builder | The System.Text.StringBuilder to append to. |
| System.String | separator | The value to place between each new appended part. If null or empty string, no separator is used. |
| System.String[] | parts | An array of strings to be appended. |
Returns
| Type | Description |
|---|---|
| System.Text.StringBuilder | A reference to |
Remarks
If parts is null or zero length, nothing is appended (and no exception is thrown).
If parts contains only a single item then separator is not used.
No separator is placed as the start even if builder is not empty.
If parts contains any null values an empty string is appended instead.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown if |
AppendJoin(StringBuilder, String, IList<String>)
Appends all the strings in parts to builder placing separator between each part.
Declaration
public static StringBuilder AppendJoin(this StringBuilder builder, string separator, IList<string> parts)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Text.StringBuilder | builder | The System.Text.StringBuilder to append to. |
| System.String | separator | The value to place between each new appended part. If null or empty string, no separator is used. |
| System.Collections.Generic.IList<System.String> | parts | An array of strings to be appended. |
Returns
| Type | Description |
|---|---|
| System.Text.StringBuilder | A reference to |
Remarks
If parts is null or contains no items, nothing is appended (and no exception is thrown).
If parts contains only a single item then separator is not used.
No separator is placed as the start even if builder is not empty.
If parts contains any null values an empty string is appended instead.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown if |
AppendJoin(StringBuilder, String, IEnumerable<String>)
Appends all the strings in parts to builder placing separator between each part.
Declaration
public static StringBuilder AppendJoin(this StringBuilder builder, string separator, IEnumerable<string> parts)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Text.StringBuilder | builder | The System.Text.StringBuilder to append to. |
| System.String | separator | The value to place between each new appended part. If null or empty string, no separator is used. |
| System.Collections.Generic.IEnumerable<System.String> | parts | An array of strings to be appended. |
Returns
| Type | Description |
|---|---|
| System.Text.StringBuilder | A reference to |
Remarks
If parts is null or contains no items, nothing is appended (and no exception is thrown).
If parts contains only a single item then separator is not used.
No separator is placed as the start even if builder is not empty.
If parts contains any null values an empty string is appended instead.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown if |