title: expected class, delegate, enum, interface or struct error C#
body: <p>have a php code like this,going to convert it in to C#.</p>
  
  <pre><code>function isValid($n){
  if (preg_match("/\d+/",$n) &gt; 0 &amp;&amp; $n&lt;1000) {
      return true;
  }
  return false;
  }
  </code></pre>
  
  <p>Here is my try,BUT error shown Error is  "expected class, delegate, enum, interface or struct error C#"</p>
  
  <pre><code>public string IsValidate(string Item)
  {
      string Result = Item;
     try
  {
  Result = System.Text.RegularExpressions.Regex.Replace(InputTxt, @"(\\)([\000\010\011\012\015\032\042\047\134\140])", "$2");
  }
  catch(Exception ex)
  {
  console.WriteLine(ex.Message)
  }
  return Result;
  }
  </code></pre>
  
  <p>What is the error,Is there any other way to implement this better than my try ?
  i got this snippet from here <a href="http://www.digitalcoding.com/Code-Snippets/C-Sharp/C-Code-Snippet-AddSlashes-StripSlashes-Escape-String.html" rel="nofollow">code</a></p>