ArrayList Variable Holding Array
i have a variable that is declared like so:
ArrayList SubDirArray = new ArrayList();
and i have a function that puts all the folders in one directory into an array:
public ArrayList ShowFolders(string SearchPat)
{
// lists all sub-folders in a folder
ArrayList alFolders = new ArrayList();
foreach (DirectoryInfo dinfo in m_dir.GetDirectories(SearchPat))
{
alFolders.Add(dinfo.Name);
}
return alFolders;
}
Now i try and assign the value of the instance method to my SubDirArray:
SubDirArray = ListObj.ShowFolders();
i dont think the SubDirArray is being filled up with the elements that are returned from ShowFolders() because when i try to use a for loop to print the elements to a console window, nothing shows up...
how do i get SubDirArray to fill up with the returning value of ShowFolders?
|