public static string Searcher(string path, string pattern)
{
var parts = new List<DirectoryInfo> { };
DirectoryInfo dir = new DirectoryInfo(path);
try
{
DirectoryInfo[] dirs = dir.GetDirectories();
foreach (DirectoryInfo di in dirs)
{
parts.Add(di);
}
}
catch { };
foreach (DirectoryInfo part in parts.ToList())
{
if(part.ToString().Contains(pattern) == true)
{
return part.ToString();
}
else
{
Searcher(part.ToString(), pattern);
}
}
return null;
}
Почему код возвращает None а не part и как это справить?