SyntaxFix
Write A Post
Hire A Developer
Questions
Try,
string[] files = new DirectoryInfo(dir).GetFiles().Select(o => o.Name).ToArray();
Above line may throw UnauthorizedAccessException. To handle this check out below link
C# Handle System.UnauthorizedAccessException in LINQ