You can rather use HttpUtility.HtmlEncode & HttpUtility.HtmlDecode like below.
First decode your string to get normal string and then encode it again which will give you expected string.
HttpUtility.HtmlEncode(HttpUtility.HtmlDecode("hello a & b, <hello world >"));
-
HttpUtility.HtmlDecode("hello a & b, <hello world >")will returnhello a & b, <hello world >. -
HttpUtility.HtmlEncode("hello a & b, <hello world >")will returnhello a & b, <hello world >