AutomationDrivers.Core.Configuration.ProjectPath.FindSubFolderPath C# (CSharp) Метод

FindSubFolderPath() приватный статический Метод

private static FindSubFolderPath ( string rootFolderPath, string folderName ) : string
rootFolderPath string
folderName string
Результат string
        private static string FindSubFolderPath(string rootFolderPath, string folderName)
        {
            var directory = new DirectoryInfo(rootFolderPath);

            directory = (directory.GetDirectories("*", SearchOption.AllDirectories)
                .Where(folder => folder.Name.ToLower() == folderName.ToLower()))
                .FirstOrDefault();

            if (directory == null)
            {
                throw new DirectoryNotFoundException();
            }

            return directory.FullName;
        }