I'm doing a check in a directory where all the items with a specific extension are ready.
I need to add the items in an array via a foreach
.
Here's part of the code I've tried.
DirectoryInfo di = new DirectoryInfo(_caminhoEmail);
FileInfo[] rgFiles = di.GetFiles("*.ost");
string[] pasta = new string[] { };
foreach (FileInfo item in rgFiles)
{
pasta = new string[] { item.FullName};
}
return pasta;
But with this code it always overwrites taking only the last array value in rgFiles[]
.
How do I add items in Array pasta
and return it at the end?