title: similar file names into array or list
body: <p>In each scenario I will have hundreds of .tif files that need to be merged with irfanview. These files are named so that matching character strings before a hyphen indicate they need to be merged (a small example set of file names could be as follows: 0001-1.tif, 0001-2.tif, 0001-3.tif, 0002-1.tif, 0002-2.tif, 0003.tif, 0004-1.tif, 0004-2.tif).  Is there a way to put files with the same "prefix" into their own array by a means of character comparison, or would trimming the file names be easier?  I would like to get all the "0001's" into an array then all the "0002's" etc.  Can someone make a suggestion on the easiest way to do this?</p>
  
  <p>This looks like it will work perfectly, but VS is not recognizing Substring. Is it because I'm trying to insert an array of files into the "GroupBy"? Here's what I have so far:</p>
  
  <pre><code>  int i = 0;
  
          string filmtext = textBox1.Text;
          string[] filmPath = Directory.GetFiles(filmtext);
          string filmfile = Path.GetFileName(filmPath[i].ToString());
  
          filmfile.GroupBy(s =&gt; s.Substring(0,4))
                  .Select(g =&gt; g.ToList())
                  .ToList();
  </code></pre>