Hi,
I have been asked to
Return a collection containing all the file names within the given directory (not including subdirectories). The code I have tried is below. It should be correct because the
myPath.AsDirectory().GetFiles()
method returns a list of files contained by the directory (excluding sub-directories).
Right now, I have a red squiggly line underneath the word 'path' next to return. It says
'cannot implicitly covert type 'string' to 'Systems.Collections.Generic.IEnumerable<string>' Why is this? How can I fix the code?
Kind regards
What I have tried:
public static IEnumerable<string> GetFiles(string path)
{
path.AsDirectory().GetFiles();
return path;
}