# Avoid redundancy of HTML entities in .NET framework

I have to store various HTML named character references for the following purposes:

1. Escaping special characters myStringBuilder.Replace("À", WebHelper.Agrave)

2. Insert spaces in legacy reports ReportButtons.Controls.Add(New LiteralControl(WebHelper.Space))

This is the way I used to store until now:

public static class WebHelper
{
#region [ Fields ]

public const string Agrave = "&Agrave;";

public const string Space = "&nbsp;";

#endregion
}


Is this Single-Generic-Helper-Class the best way to solve this problem? Should all my programs reference it?

• Calling &nbsp; just “space” is confusing. It's not the normal space, it's a non-breaking space. Jul 4, 2014 at 16:13