So I have developed something in WPF C#. It browses for a file first in order to make the system works. However if the chosen folder is in the wrong file then it throws an error
An exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll but was not handled in user code
var browse = new System.Windows.Forms.FolderBrowserDialog();
browse.Description = "Select a folder containing *.train files.";
if (browse.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return;
string[] fileNames = Directory.GetFiles(browse.SelectedPath, "*.train");
Array.Sort(fileNames);
Thank you in advance!