Well anywho I've wrapped it in my code: string[] arrayDirEntries(string path, SpanMode spanMode) { string[] result; foreach (string name; dirEntries(path, spanMode)) { result ~= name; } return result; }