I have to store the files in a directory in an array and then iterate through that array.
System.IO.DriveInfo dirOrigen = new System.IO.DriveInfo(ruta1);
System.IO.DirectoryInfo dirOrigenInfo = dirOrigen.RootDirectory;
System.IO.FileInfo[] fileDirOrigenNames = dirOrigenInfo.GetFiles("*.*");
for (int i=0;i<fileDirOrigenNames.GetLength;i++ )
{
...
}
At the moment I have this code, it gives me an error in the for
confileDirOrigenNames.GetLength
I assume you come from Java.
fileDirOrigenNames
is an array ofSystem.IO.FileInfo
. To query the size of an array in C# you have two options: the propertyLength
or the methodGetLength
that needs to receive a parameter with the dimension you want to get the size of. Try this:or this