private string[] ColeccionDeCortes(string Path)
{
DirectoryInfo X = new DirectoryInfo(Path);
FileInfo[] listaDeArchivos = X.GetFiles();
string[] Coleccion;
foreach (FileInfo FI in listaDeArchivos)
{
//Add the FI.Name to the Coleccion[] array,
}
return Coleccion;
}
I’d like to convert the FI.Name to a string and then add it to my array. How can I do this?
You can’t add items to an array, since it has fixed length. What you’re looking for is a
List<string>, which can later be turned to an array usinglist.ToArray(), e.g.