public static HtmlAttributeEncode ( char value, int startIndex, int count, char quote = '"' ) : string | ||
value | char | The attribute value to encode. |
startIndex | int | The starting index of the attribute value. |
count | int | The number of characters in the attribute value. |
quote | char | The character to use for quoting the attribute value. |
리턴 | string |
/// <summary> /// Write the HTML tag to a <see cref="System.IO.TextWriter"/>. /// </summary> /// <remarks> /// Writes the HTML tag to a <see cref="System.IO.TextWriter"/>. /// </remarks> /// <param name="output">The output.</param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="output"/> is <c>null</c>. /// </exception> public override void WriteTo(TextWriter output) { if (output == null) { throw new ArgumentNullException(nameof(output)); } output.Write('<'); if (IsEndTag) { output.Write('/'); } output.Write(Name); for (int i = 0; i < Attributes.Count; i++) { output.Write(' '); output.Write(Attributes[i].Name); if (Attributes[i].Value != null) { output.Write('='); HtmlUtils.HtmlAttributeEncode(output, Attributes[i].Value); } } if (IsEmptyElement) { output.Write('/'); } output.Write('>'); }
void EncodeAttributeValue(string value) { if (WriterState != HtmlWriterState.Attribute) { throw new InvalidOperationException("Attribute values can only be written in the Attribute state."); } html.Write('='); HtmlUtils.HtmlAttributeEncode(html, value); WriterState = HtmlWriterState.Tag; }
void EncodeAttributeValue(char[] value, int startIndex, int count) { if (WriterState != HtmlWriterState.Attribute) { throw new InvalidOperationException("Attribute values can only be written in the Attribute state."); } html.Write('='); HtmlUtils.HtmlAttributeEncode(html, value, startIndex, count); WriterState = HtmlWriterState.Tag; }