System.IO.DirectoryInfo.GetFileSystemInfos C# (CSharp) Method

GetFileSystemInfos() public method

public GetFileSystemInfos ( String searchPattern, SearchOption searchOption ) : System.IO.FileSystemInfo[]
searchPattern String
searchOption SearchOption
return System.IO.FileSystemInfo[]
        public FileSystemInfo[] GetFileSystemInfos(String searchPattern, SearchOption searchOption)
        {
            if (searchPattern == null)
                throw new ArgumentNullException(nameof(searchPattern));
            if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                throw new ArgumentOutOfRangeException(nameof(searchOption), SR.ArgumentOutOfRange_Enum);
            Contract.EndContractBlock();

            return InternalGetFileSystemInfos(searchPattern, searchOption);
        }

Same methods

DirectoryInfo::GetFileSystemInfos ( ) : System.IO.FileSystemInfo[]
DirectoryInfo::GetFileSystemInfos ( String searchPattern ) : System.IO.FileSystemInfo[]
DirectoryInfo::GetFileSystemInfos ( ) : System.IO.FileSystemInfo[]
DirectoryInfo::GetFileSystemInfos ( string searchPattern ) : System.IO.FileSystemInfo[]
DirectoryInfo::GetFileSystemInfos ( string searchPattern, System searchOption ) : System.IO.FileSystemInfo[]

Usage Example

Ejemplo n.º 1
0
 public IEnumerable<string> FileAndFolderNamesIn(string path, string searchPattern = null)
 {
     var directoryInfo = new DirectoryInfo(path);
     if (string.IsNullOrEmpty(searchPattern))
     {
         return directoryInfo.GetFileSystemInfos().Select(info => info.Name).ToList();
     }
     return directoryInfo.GetFileSystemInfos(searchPattern).Select(info => info.Name).ToList();
 }
All Usage Examples Of System.IO.DirectoryInfo::GetFileSystemInfos