title: How to make sure that Roslyn Analyser does not run in some special cases
body: <p>I have written a code analyzer by using Roslyn APIs. The analyzer search for the hardcoded Urls in the code and fails the compilation of the code.</p>
  
  <p>For example:</p>
  
  <pre><code>public class{
  
      public static string demo = "https://demo.com"; 
  }
  </code></pre>
  
  <p>My analyser will fail the compilation of the above code saying it found the hard coded Url in the code.</p>
  
  <p>There are some scenarios in which i want the analyzer to ignore the hardcoded urls error(in case its completely mandatory for the user to use it).</p>
  
  <p>Is there anyway by which i will be able to give analyzer the signal to ignore the hardcoded Url.</p>
  
  <p>I thought of using something like this:</p>
  
  <pre><code>public class{
      #region IGNORE HARDCODED URLS
      public static string demo = "https://demo.com"; 
      #endregion
  }
  </code></pre>
  
  <p>But the problem with this approach is that i am unable to get all the variable declared inside the region IGNORE HARDCODED URLS.</p>
  
  <p>Questions:</p>
  
  <p>1.) Is this approach of using regions seems good for the use-case i am trying to solve? Is there any other better solutions you guys can think of and provide?</p>
  
  <p>2.) If my approach looks good, then can somebody tell me how to get all the variables declared in the particular region?</p>