Are there any benefits to using HtmlTextWriter if you are not going to benefit from adaptive rendering?

后端 未结 5 1238
北恋
北恋 2021-02-07 11:17

Outside of benefiting from Adaptive Rendering for alternate devices, does it ever make sense to write all of this code:

writer.WriteBeginTag(\"t         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-07 12:02

    HtmlTextWriter is beneficial because:

    HtmlTextWriter is the cleanest and the mark-up is nicely indented when it is rendered.

    There is a performance impact as HtmlTextWriter writes directly to the output stream. Stringbuilder doesn't write to the output stream until ToString is called on it.

    There is an example on why you would use HtmlTextWriter for Saving and Reusing HTML Output here as well.

提交回复
热议问题