TunnelVisionLabs.Net.UriTemplate/UriTemplatePartExpansion.cs
/// <summary>
/// This helper method writes a string value to the <see cref="StringBuilder"/> output,
/// percent-encoding characters and restricting the output according to the variable
/// <see cref="VariableReference.Prefix"/> as necessary.
/// </summary>
/// <remarks>
/// <para>Characters which are not <c>unreserved</c> or <c>reserved</c> characters according
/// to RFC 6570 are always percent-encoded when they are appended.</para>
/// </remarks>
/// <param name="builder">The <see cref="StringBuilder"/> to append text to.</param>
/// <param name="variable">The variable being rendered.</param>
/// <param name="value">The string value of the variable being rendered.</param>
/// <param name="escapeReserved"><see langword="true"/> to percent-encode <c>reserved</c> characters defined by RFC 6570; otherwise, <see langword="false"/>.</param>
/// <exception cref="ArgumentNullException">
/// <para>If <paramref name="builder"/> is <see langword="null"/>.</para>
/// <para>-or-</para>
/// <para>If <paramref name="variable"/> is <see langword="null"/>.</para>
/// <para>-or-</para>
/// <para>If <paramref name="value"/> is <see langword="null"/>.</para>
/// </exception>
This helper method writes a string value to the  output,
percent-encoding characters and restricting the output according to the variable
as necessary.
This helper method writes a string value to the output percent - encoding characters and restricting the output according to the variable as necessary .
protected static void AppendText(StringBuilder builder, VariableReference variable, string value, bool escapeReserved)
        {
            if (builder == null)
                throw new ArgumentNullException("builder");
            if (variable == null)
                throw new ArgumentNullException("variable");
            if (value == null)
                throw new ArgumentNullException("value");
            string text = value;
            if (variable.Prefix != null && text.Length > variable.Prefix)
                text = text.Substring(0, variable.Prefix.Value);
            text = EncodeReservedCharacters(text, !escapeReserved);
            builder.Append(text);
        }
protected static void AppendText ( StringBuilder builder , VariableReference variable , string value , bool escapeReserved ) { if ( builder == null ) throw new ArgumentNullException ( " " ) ; if ( variable == null ) throw new ArgumentNullException ( " " ) ; if ( value == null ) throw new ArgumentNullException ( " " ) ; string text = value ; if ( variable . Prefix != null && text . Length > variable . Prefix ) text = text . Substring ( 0 , variable . Prefix . Value ) ; text = EncodeReservedCharacters ( text , ! escapeReserved ) ; builder . Append ( text ) ; }
This helper method writes a string value to the  output,
percent-encoding characters and restricting the output according to the variable
as necessary.
This helper method writes a string value to the output percent - encoding characters and restricting the output according to the variable as necessary .
None
builder
StringBuilder
The  to append text to.
The to append text to .
variable
VariableReference
The variable being rendered.
The variable being rendered .
value
string
The string value of the variable being rendered.
The string value of the variable being rendered .
escapeReserved
bool
to percent-encode reserved.
to percent - encode reserved .
remarks
Characters which are not unreservedreserved
Characters which are not unreservedreserved