Remove Tags from String in C#

Sometimes we get error in string variable because of html tags in string. There is simple and easier way to remove html tags from string. There is a few lines of code which will help you to remove tags from string.
  1. using System.Text.RegularExpressions //Firstly, you have to add one namespace.  
  2.   
  3. string strWithHtml = "<h1>Sample</h1> p> Hello this is a sample text with html tags.  Code will remove all the tags from text.</p>"// string with html tags  
  4.   
  5. string noHTML = Regex.Replace(strWithHtml, @"<[^>]+>| """).Trim();  
  6.   
  7. Response.Write(noHTML);