StringExtensions

Extension methods for System.String that provide fluent append operations with optional conditional support.

Definition

Namespace: Paragon Assembly: Paragon.dll

public static class StringExtensions

Quick Lookup

Goal
Method

Append a character

str.Append('!')

Append a string

str.Append(" world")

Conditionally append a character

str.AppendIf(condition, '!')

Conditionally append a string

str.AppendIf(condition, " world")

Methods

Append (char)

Appends a character to the string.

public static string Append(this string @string, char append)
Parameter
Type
Description

@string

string

The source string

append

char

The character to append

Returns: A new string with the character appended.

Append (string)

Appends a string to the string.

Parameter
Type
Description

@string

string

The source string

append

string

The string to append

Returns: A new concatenated string.

AppendIf (char)

Conditionally appends a character. Returns the original string unchanged if the condition is false.

Parameter
Type
Description

@string

string

The source string

condition

bool

Whether to append

append

char

The character to append if condition is true

Returns: The original string (if false) or the string with the character appended (if true).

AppendIf (string)

Conditionally appends a string. Returns the original string unchanged if the condition is false.

Parameter
Type
Description

@string

string

The source string

condition

bool

Whether to append

append

string

The string to append if condition is true

Returns: The original string (if false) or the concatenated string (if true).

Examples

Fluent string building

See Also

Last updated