public static IEnumerable <FileInfo> EnumerateFiles(
        this DirectoryInfo directoryInfo,
        string searchPattern,
        SearchOption searchOption
        )
    {
        if (searchPattern == null)
        {
            throw new ArgumentNullException("searchPattern");
        }

        return(DirectoryInfoEditorExtensions.CreateEnumerateFilesIterator(directoryInfo, searchPattern, searchOption));
    }
    public static IEnumerable <FileSystemInfo> EnumerateFileSystemInfos(
        this DirectoryInfo directoryInfo,
        string searchPattern,
        SearchOption searchOption
        )
    {
        if (searchPattern == null)
        {
            throw new ArgumentNullException("searchPattern");
        }
        if (searchOption != SearchOption.TopDirectoryOnly && searchOption != SearchOption.AllDirectories)
        {
            throw new ArgumentOutOfRangeException("searchoption");
        }

        return(DirectoryInfoEditorExtensions.CreateEnumerateFileSystemInfosIterator(directoryInfo, searchPattern, searchOption));
    }