title: How to read whole file but skip commented code in c#
body: <p>I am creating a windows app that will read all files in directory, here is the code.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.IO;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  namespace LathropFileScan
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void btnprint_Click(object sender, EventArgs e)
          {
              TextWriter text = new StreamWriter("FileScan.csv");
              List&lt;string&gt; files = new List&lt;string&gt;();
  
              foreach (string folders in Directory.GetDirectories(@"C:\Users\Desktop\Application","*",SearchOption.AllDirectories))
              {
                  foreach (string file in Directory.GetFiles(folders))
                  {
                      int counter = 0;
  
                      foreach (string innerfile in Directory.GetFiles(folders))
                      {
  
                              string content = File.ReadAllText(innerfile);
  
                          if (content.Contains(Path.GetFileName(file)))
                              counter++;
  
                      }
  
                      if (counter == 0)
                      {
  
                              files.Add(file.Substring(34));
  
                      }
                  }
              }
              foreach (string print in files)
              {
                  text.Write(print + Environment.NewLine);
              }
  
              text.Close();
          }
      }
  }
  </code></pre>
  
  <p>By using this code I can successfully read all files of the directory but File.ReadAllText() also reads the commented code. I want to skip commented code and just want to read uncommented code. Is there anyway to do that.
  Thanks.</p>