public override void WriteComment (string text)
{
if (text == null)
throw ArgumentError ("text");
if (text.Length > 0 && text [text.Length - 1] == '-')
throw ArgumentError ("An input string to WriteComment method must not end with '-'. Escape it with 'D;'.");
if (StringUtil.IndexOf (text, "--") > 0)
throw ArgumentError ("An XML comment cannot end with \"-\".");
if (state == WriteState.Attribute || state == WriteState.Element)
CloseStartElement ();
WriteIndent ();
ShiftStateTopLevel ("Comment", false, false, false);
writer.Write ("<!--");
writer.Write (text);
writer.Write ("-->");
}