c# - Get all file names in a directory ignoring file extension -


i have folder files this:

foo.map foo.ind foo.dat bar.map bar.ind bar.dat readme.txt readme.html 

i distinct file names without extension, i.e. foo, bar, readme.

of course can use directory.getfiles() , make loop path.getfilenamewithoutextension() wonder if there short way, maybe 1 line, e.g. using linq?

how about:

directory     .getfiles()     .select(f => path.getfilenamewithoutextension(f.name))     .distinct(); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -