System.IO.DirectoryInfo.GetDirectories C# (CSharp) Méthode

GetDirectories() public méthode

public GetDirectories ( ) : System.IO.DirectoryInfo[]
Résultat System.IO.DirectoryInfo[]
        public DirectoryInfo[] GetDirectories()
        {
            return InternalGetDirectories("*", SearchOption.TopDirectoryOnly);
        }

Same methods

DirectoryInfo::GetDirectories ( String searchPattern ) : System.IO.DirectoryInfo[]
DirectoryInfo::GetDirectories ( String searchPattern, SearchOption searchOption ) : System.IO.DirectoryInfo[]
DirectoryInfo::GetDirectories ( ) : System.IO.DirectoryInfo[]
DirectoryInfo::GetDirectories ( string searchPattern ) : System.IO.DirectoryInfo[]
DirectoryInfo::GetDirectories ( string searchPattern, System searchOption ) : System.IO.DirectoryInfo[]

Usage Example

        //Appends the any xml file/folder nodes onto the folder
        private void AddXmlNodes(FolderCompareObject folder, int numOfPaths, XmlDocument xmlDoc)
        {
            List<XMLCompareObject> xmlObjList = new List<XMLCompareObject>();
            List<string> xmlFolderList = new List<string>();

            for (int i = 0; i < numOfPaths; i++)
            {
                string path = Path.Combine(folder.GetSmartParentPath(i), folder.Name);

                if (Directory.Exists(path))
                {
                    DirectoryInfo dirInfo = new DirectoryInfo(path);
                    FileInfo[] fileList = dirInfo.GetFiles();
                    DirectoryInfo[] dirInfoList = dirInfo.GetDirectories();
                    string xmlPath = Path.Combine(path, CommonXMLConstants.MetadataPath);

                    if (!File.Exists(xmlPath))
                        continue;

                    CommonMethods.LoadXML(ref xmlDoc, xmlPath);
                    xmlObjList = GetAllFilesInXML(xmlDoc);
                    xmlFolderList = GetAllFoldersInXML(xmlDoc);
                    RemoveSimilarFiles(xmlObjList, fileList);
                    RemoveSimilarFolders(xmlFolderList, dirInfoList);
                }

                AddFileToChild(xmlObjList, folder, i, numOfPaths);
                AddFolderToChild(xmlFolderList, folder, i, numOfPaths);
                xmlObjList.Clear();
                xmlFolderList.Clear();
            }
        }
All Usage Examples Of System.IO.DirectoryInfo::GetDirectories