class Program
{
static void Main( string[ ] args)
{
foreach ( var f in enumfiles( @"D:\\ " ) )
{
Console.WriteLine ( f) ;
}
}
static IEnumerable< string> enumfiles( string dirname)
{
var stack = new Stack< string> ( ) ;
stack.Push ( dirname) ;
while ( stack.Count > 0 )
{
var present = stack.Pop ( ) ;
foreach ( var f in Directory.EnumerateFiles ( present, "*" ) )
{
yield return f;
}
foreach ( var d in Directory.EnumerateDirectories ( present) )
{
stack.Push ( d) ;
}
}
}
}
ICAgIGNsYXNzIFByb2dyYW0KICAgIHsKICAgICAgICBzdGF0aWMgdm9pZCBNYWluKHN0cmluZ1tdIGFyZ3MpCiAgICAgICAgewogICAgICAgICAgICBmb3JlYWNoICh2YXIgZiBpbiBlbnVtZmlsZXMoQCJEOlxcIikpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKGYpOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBzdGF0aWMgSUVudW1lcmFibGU8c3RyaW5nPiBlbnVtZmlsZXMoc3RyaW5nIGRpcm5hbWUpCiAgICAgICAgewogICAgICAgICAgICB2YXIgc3RhY2sgPSBuZXcgU3RhY2s8c3RyaW5nPigpOwogICAgICAgICAgICBzdGFjay5QdXNoKGRpcm5hbWUpOwoKICAgICAgICAgICAgd2hpbGUgKHN0YWNrLkNvdW50ID4gMCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmFyIHByZXNlbnQgPSBzdGFjay5Qb3AoKTsKICAgICAgICAgICAgICAgIGZvcmVhY2ggKHZhciBmIGluIERpcmVjdG9yeS5FbnVtZXJhdGVGaWxlcyhwcmVzZW50LCAiKiIpKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHlpZWxkIHJldHVybiBmOwogICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgIGZvcmVhY2ggKHZhciBkIGluIERpcmVjdG9yeS5FbnVtZXJhdGVEaXJlY3RvcmllcyhwcmVzZW50KSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBzdGFjay5QdXNoKGQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgIH0=
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