Can someone tell me what I'm doing wrong with the following Linq query? I'm trying to find the directory with the highest aphanumerical value.
DirectoryInfo[] diList = currentDirectory.GetDirectories();
var dirs = from eachDir in diList
orderby eachDir.FullName descending
select eachDir;
MessageBox.Show(dirs[0].FullName);
EDIT:
The above code does not compile, the error that the compiler generates is:
Cannot apply indexing with [] to an expression of type 'System.Linq.IOrderedEnumerable<System.IO.DirectoryInfo>