Quick question: Size limitation in Directory.GetFiles or string ?
Posted on 2004-08-20
I am having a problem getting the contents of a directory with 479 files. The code is as follows:
strFiles = Directory.GetFiles ("target");
for (int counter = 0; counter < strFiles.Length; counter++)
if (strFiles [counter].EndsWith (".jpg") || strFiles [counter].EndsWith (".jpeg"))
lvwFiles.Items [counter].Tag = strFiles [counter];
The error I get is:
"An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.forms.dll
"Additional information: Specified argument was out of the range of valid values."
The error occurs when counter is 379. Is there a size limitation to the string  or the Directory.GetFiles () function that I don't know about? If not any suggestions as to why I am getting the problem?
Thank you in advance...