示例#1
0
 /// <summary>
 /// /// Returns all the directories in the directory tree below <paramref name="directory"/>
 /// </summary>
 /// <param name="directory"></param>
 /// <returns></returns>
 public static IEnumerable <DirectoryInfo> DirectoriesRecursive(this DirectoryInfo directory)
 {
     Contract.Requires(directory != null);
     Contract.Ensures(Contract.Result <IEnumerable <DirectoryInfo> >() != null);
     //Contract.Ensures(Contract.Result<IEnumerable<DirectoryInfo>>().None(dir => dir == null));
     return(directory.AsHierarchy(dir => dir.GetDirectories()).Flatten().Unwrap());
 }