fork download
  1. using System;
  2. using System.IO;
  3. using System.Collections.Generic;
  4.  
  5. namespace ConsoleApplication1
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. //StreamWriter w = new StreamWriter("list.txt", false);
  12. //Console.SetOut(w);
  13.  
  14. string path = @"C:\";
  15.  
  16. Stack<DirectoryInfo> stack = new Stack<DirectoryInfo>();
  17. Console.WriteLine(path);
  18.  
  19. var di = new DirectoryInfo(path);
  20. foreach (var d in di.EnumerateDirectories("*", SearchOption.TopDirectoryOnly))
  21. {
  22. stack.Push(d);
  23. }
  24. foreach (var f in di.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
  25. {
  26. Console.WriteLine(f.FullName);
  27. }
  28.  
  29. while (stack.Count > 0)
  30. {
  31. di = stack.Pop();
  32. Console.WriteLine(di.FullName);
  33.  
  34. foreach (var d in di.EnumerateDirectories("*", SearchOption.TopDirectoryOnly))
  35. {
  36. stack.Push(d);
  37. }
  38. foreach (var f in di.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
  39. {
  40. Console.WriteLine(f.FullName);
  41. }
  42. }
  43.  
  44. //w.Flush();
  45. //w.Close();
  46. //w.Dispose();
  47.  
  48. Console.ReadLine();
  49. }
  50. }
  51. }
  52.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(20,34): error CS1061: Type `System.IO.DirectoryInfo' does not contain a definition for `EnumerateDirectories' and no extension method `EnumerateDirectories' of type `System.IO.DirectoryInfo' could be found (are you missing a using directive or an assembly reference?)
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(24,34): error CS1061: Type `System.IO.DirectoryInfo' does not contain a definition for `EnumerateFiles' and no extension method `EnumerateFiles' of type `System.IO.DirectoryInfo' could be found (are you missing a using directive or an assembly reference?)
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(34,38): error CS1061: Type `System.IO.DirectoryInfo' does not contain a definition for `EnumerateDirectories' and no extension method `EnumerateDirectories' of type `System.IO.DirectoryInfo' could be found (are you missing a using directive or an assembly reference?)
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(38,38): error CS1061: Type `System.IO.DirectoryInfo' does not contain a definition for `EnumerateFiles' and no extension method `EnumerateFiles' of type `System.IO.DirectoryInfo' could be found (are you missing a using directive or an assembly reference?)
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
Compilation failed: 4 error(s), 0 warnings
stdout
Standard output is empty