src/openSourceC.DotNetLibrary.Core/Extensions/StringBuilderExtensions.cs
/// <summary>
///		Appends a <see cref="DateTimeOffset"/> value to the parameters collection after converting it to a <see cref="DateTime"/> value.
/// </summary>
/// <param name="stringBuilder">The <see cref="StringBuilder"/> object.</param>
/// <param name="key">The query-string key.</param>
/// <param name="dateTimeFormat">The DateTime format to use.</param>
/// <param name="value">The query-string value.</param>
/// <param name="kind">The <see cref="E:DateTimeKind"/> to use for the conversion.</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  value to the parameters collection after converting it to a  value.
Appends a value to the parameters collection after converting it to a value .
public static StringBuilder AppendQueryStringPair(this StringBuilder stringBuilder, string key, string dateTimeFormat, DateTimeOffset? value, DateTimeKind kind, DateTimeOffset? defaultValue = null)
		{
			if ((value ??= defaultValue).HasValue)
			{
				switch (kind)
				{
					case DateTimeKind.Local:
					{
						return stringBuilder.AppendQueryStringPair(key, value!.Value.LocalDateTime.ToString(dateTimeFormat));
					}
					case DateTimeKind.Utc:
					{
						return stringBuilder.AppendQueryStringPair(key, value!.Value.UtcDateTime.ToString(dateTimeFormat));
					}
					case DateTimeKind.Unspecified:
					default:
					{
						return stringBuilder.AppendQueryStringPair(key, value!.Value.DateTime.ToString(dateTimeFormat));
					}
				}
			}
			return stringBuilder;
		}
public static StringBuilder AppendQueryStringPair ( this StringBuilder stringBuilder , string key , string dateTimeFormat , DateTimeOffset ? value , DateTimeKind kind , DateTimeOffset ? defaultValue = null ) { if ( ( value ??= defaultValue ) . HasValue ) { switch ( kind ) { case DateTimeKind . Local : { return stringBuilder . AppendQueryStringPair ( key , value ! . Value . LocalDateTime . ToString ( dateTimeFormat ) ) ; } case DateTimeKind . Utc : { return stringBuilder . AppendQueryStringPair ( key , value ! . Value . UtcDateTime . ToString ( dateTimeFormat ) ) ; } case DateTimeKind . Unspecified : default : { return stringBuilder . AppendQueryStringPair ( key , value ! . Value . DateTime . ToString ( dateTimeFormat ) ) ; } } } return stringBuilder ; }
Appends a  value to the parameters collection after converting it to a  value.
Appends a value to the parameters collection after converting it to a value .
The modified  object.
The modified object .
StringBuilder
this
key
string
The query-string key.
The query - string key .
dateTimeFormat
string
The DateTime format to use.
The DateTime format to use .
value
DateTimeOffset?
The query-string value.
The query - string value .
kind
DateTimeKind
The  to use for the conversion.
The to use for the conversion .
defaultValue
DateTimeOffset?
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