src/openSourceC.DotNetLibrary.Core/Extensions/StringBuilderExtensions.cs
/// <summary>
///		Appends a <see cref="M:WebUtility.UrlEncode"/> encoded query-string key-value pair
///		to the end of the <see cref="StringBuilder"/> object.
/// </summary>
/// <param name="stringBuilder">The <see cref="StringBuilder"/> object.</param>
/// <param name="key">The query-string key.</param>
/// <param name="value">The query-string value.</param>
/// <param name="defaultValue">The query-string default value, used if value is null or
///		empty. (optional)</param>
/// <returns>
///		The modified <see cref="StringBuilder"/> object.
/// </returns>
Appends a  encoded query-string key-value pair
to the end of the  object.
Appends a encoded query - string key - value pair to the end of the object .
public static StringBuilder AppendQueryStringPair(this StringBuilder stringBuilder, string key, string? value, string? defaultValue = null)
		{
			if (!string.IsNullOrEmpty(value = (string.IsNullOrEmpty(value) ? defaultValue : value)))
			{
				if (stringBuilder.Length != 0) { stringBuilder.Append('&'); }
				return stringBuilder.Append(WebUtility.UrlEncode(key)).Append('=').Append(WebUtility.UrlEncode(value));
			}
			return stringBuilder;
		}
public static StringBuilder AppendQueryStringPair ( this StringBuilder stringBuilder , string key , string ? value , string ? defaultValue = null ) { if ( ! string . IsNullOrEmpty ( value = ( string . IsNullOrEmpty ( value ) ? defaultValue : value ) ) ) { if ( stringBuilder . Length != 0 ) { stringBuilder . Append ( ' ' ) ; } return stringBuilder . Append ( WebUtility . UrlEncode ( key ) ) . Append ( ' ' ) . Append ( WebUtility . UrlEncode ( value ) ) ; } return stringBuilder ; }
Appends a  encoded query-string key-value pair
to the end of the  object.
Appends a encoded query - string key - value pair to the end of the object .
The modified  object.
The modified object .
StringBuilder
this
key
string
The query-string key.
The query - string key .
value
string?
The query-string value.
The query - string value .
defaultValue
string?
The query-string default value, used if value is null or
empty. (optional)
The query - string default value used if value is null or empty . ( optional )
stringBuilder
None