fork download
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. foreach (var f in enumfiles(@"D:\\"))
  6. {
  7. Console.WriteLine(f);
  8. }
  9. }
  10.  
  11. static IEnumerable<string> enumfiles(string dirname)
  12. {
  13. var stack = new Stack<string>();
  14. stack.Push(dirname);
  15.  
  16. while (stack.Count > 0)
  17. {
  18. var present = stack.Pop();
  19. foreach (var f in Directory.EnumerateFiles(present, "*"))
  20. {
  21. yield return f;
  22. }
  23.  
  24. foreach (var d in Directory.EnumerateDirectories(present))
  25. {
  26. stack.Push(d);
  27. }
  28. }
  29. }
  30.  
  31. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(11,16): error CS0246: The type or namespace name `IEnumerable' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty