Converting & to & etc

前端 未结 6 649
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-28 11:54

I want to convert & to &, " to \" etc. Is there a function in c# that could do that without writing all the options manually?<

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-28 11:56

    Use the static method

    HttpUtility.HtmlEncode
    

    to change & to & and " to ". Use

    HttpUtility.HtmlDecode
    

    to do the reverse.

提交回复
热议问题