Class StringBuilderExtensions
- Namespace
- FluentCommand.Extensions
- Assembly
- FluentCommand.dll
StringBuilder extension methods
public static class StringBuilderExtensions
- Inheritance
-
StringBuilderExtensions
- Inherited Members
Methods
AppendIf(StringBuilder, string, bool)
Appends a copy of the specified string if condition
is met.
public static StringBuilder AppendIf(this StringBuilder sb, string text, bool condition)
Parameters
sb
StringBuilderThe StringBuilder instance to append to.
text
stringThe string to append.
condition
boolThe condition delegate to evaluate. If condition is null, String.IsNullOrWhiteSpace method will be used.
Returns
AppendIf(StringBuilder, string, Func<string, bool>)
Appends a copy of the specified string if condition
is met.
public static StringBuilder AppendIf(this StringBuilder sb, string text, Func<string, bool> condition = null)
Parameters
sb
StringBuilderThe StringBuilder instance to append to.
text
stringThe string to append.
condition
Func<string, bool>The condition delegate to evaluate. If condition is null, String.IsNullOrWhiteSpace method will be used.
Returns
AppendJoin<T>(StringBuilder, string, IEnumerable<T>)
Concatenates and appends the members of a collection, using the specified separator between each member.
public static StringBuilder AppendJoin<T>(this StringBuilder sb, string separator, IEnumerable<T> values)
Parameters
sb
StringBuilderA reference to this instance after the append operation has completed.
separator
stringThe string to use as a separator. separator is included in the concatenated and appended strings only if values has more than one element.
values
IEnumerable<T>A collection that contains the objects to concatenate and append to the current instance of the string builder.
Returns
- StringBuilder
A reference to this instance after the append operation has completed.
Type Parameters
T
The type of the members of values.
AppendLine(StringBuilder, string, params object[])
Appends a copy of the specified string followed by the default line terminator to the end of the StringBuilder object.
public static StringBuilder AppendLine(this StringBuilder sb, string format, params object[] args)
Parameters
sb
StringBuilderThe StringBuilder instance to append to.
format
stringA composite format string.
args
object[]An object array that contains zero or more objects to format.
Returns
AppendLineIf(StringBuilder, Func<bool>)
Appends a copy of the specified string followed by the default line terminator if condition
is met.
public static StringBuilder AppendLineIf(this StringBuilder sb, Func<bool> condition)
Parameters
sb
StringBuilderThe StringBuilder instance to append to.
condition
Func<bool>The condition delegate to evaluate. If condition is null, String.IsNullOrWhiteSpace method will be used.
Returns
AppendLineIf(StringBuilder, string, Func<string, bool>)
Appends a copy of the specified string followed by the default line terminator if condition
is met.
public static StringBuilder AppendLineIf(this StringBuilder sb, string text, Func<string, bool> condition = null)
Parameters
sb
StringBuilderThe StringBuilder instance to append to.
text
stringThe string to append.
condition
Func<string, bool>The condition delegate to evaluate. If condition is null, String.IsNullOrWhiteSpace method will be used.