Skip to content

@ChrisMissal /GetFirstDirectoryFrom1.cs
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Different versions of GetFirstDirectoryFrom
public DirectoryInfo GetFirstDirectoryFrom(params string[] list)
{
foreach (var item in list)
{
var directory = new DirectoryInfo(item);
if (directory.Exists)
return directory;
}
return null;
}
public DirectoryInfo GetFirstDirectoryFrom(params string[] list)
{
return list.Select(l => new DirectoryInfo(l)).Where(d => d.Exists).FirstOrDefault();
}
public DirectoryInfo GetFirstDirectoryFrom(params string[] list)
{
return list.Select(l => new DirectoryInfo(l)).SkipWhile(d => !d.Exists).FirstOrDefault();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.