The .NET Framework 4.0 and above provides the WebUtility.HtmlDecode class which lets the developers to convert the string which are encoded with HTML characters to plain string .
How to Decode HTML Characters in C# ?
Below is a sample code snippet that demonstrates how to decode HTML characters in C#.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
namespace AbundantCode
{
internal class Program
{
private static void Main(string[] args)
{
string HtmlString = "Abundantcode website ";
string DecodedString = WebUtility.HtmlDecode(HtmlString);
Console.WriteLine(DecodedString);
Console.ReadLine();
}
}
}
Leave a Reply