How to Remove html tags from string in c#

  private List<ArticlesEntity> RemoveHtmltags(List<ArticlesEntity> articles)

        {

            List<ArticlesEntity> artls = new List<ArticlesEntity>();

            artls = articles;

            foreach(var item in artls)

            {

                if (item.Content != "" && item.Content != null && item.Content != string.Empty)

                {

                    item.Content= Regex.Replace(item.Content, "<.*?>", " ");//here html tags are removed

                }

            }

            return artls;

        }

Comments

Popular posts from this blog

How to use youtube api's in your application.

Implement virtualisation in kendo drop down list using jquery ajax in mvc, aspx page

Interview Questions-2