title: I have a class of FileDetail which contains FileName,how can I return duplicate filenames within that class
body: <p>I have the following code which will return the filename of all files within my directory and sub-directories of documents. I would now want to compare files which have identical filenames and see if their size is the same. I am not sure on how I would be able to add duplicate file names to a class and to then compare the filesize of these.</p>
  <p>Below is the code I have working so far</p>
  <pre><code>private static void ListAllDuplicateFiles()
  {
      string[] files = Directory.GetFiles(rootPath, &quot;*.*&quot;, SearchOption.AllDirectories);
      List&lt;FileDetail&gt; fileDetails = new List&lt;FileDetail&gt;();
      foreach (string file in files)
      {
          FileInfo fileInfo = new FileInfo(file);
          FileDetail fileDetail = new FileDetail(fileInfo);
          fileDetails.Add(fileDetail);
      }
  
      foreach (FileDetail fileDetail in fileDetails)
      {
          Console.WriteLine(fileDetail.Filename);
      }
  
      Console.ReadLine();
  }
  </code></pre>