I'm using HtmlTextWriter
to output html to a stream. However, I'm missing a way to write html comments. Of course, I could write an extension method doing
public static void WriteComment(this HtmlTextWriter writer, string comment)
{
writer.Write("<!-- ");
writer.WriteEncodedText(comment);
writer.Write(" -->");
}
But that does feel a bit inelegant - is there some built-in method I'm not seeing?