title: Search files based on date created in c#
body: <p>I have this function that I use to read a directory and get files with a specific  search pattern. Is there a way to use a search pattern based on the created date or modified date?</p>
  
  <pre><code>public static List&lt;FileInfo&gt; GetFileList(string fileSearchPattern, string rootFolderPath)
  {
      DirectoryInfo rootDir = new DirectoryInfo(rootFolderPath);
  
      List&lt;DirectoryInfo&gt; dirList = new List&lt;DirectoryInfo&gt;(
          rootDir.GetDirectories("*", SearchOption.AllDirectories));
      dirList.Add(rootDir);
  
      List&lt;FileInfo&gt; fileList = new List&lt;FileInfo&gt;();
  
      foreach (DirectoryInfo dir in dirList)
      {
          fileList.AddRange(
              dir.GetFiles(fileSearchPattern, SearchOption.TopDirectoryOnly));
      }
  
      return fileList;
  }
  </code></pre>