What is the most modern way to write a file browser in C#
I found some resources about how to write a Fi开发者_Go百科le Browser in C#, but the were all at least 3 years old. I am wondering if importing the shell32 DLL is still the best way to do this. I am a mac developer by trade so please excuse me if my question is a little strange. It just seems this method is going outside of the .NET framework and I was wondering if there is a better way. Thanks
Sorry if I've misunderstood you, but it sounds like you're trying to create something to scan through directories and get lists of files. If so, then check out System.IO. The File and Directory classes along with FileInfo and DirectoryInfo should give you everything you need.
http://msdn.microsoft.com/en-us/library/system.io.aspx
http://msdn.microsoft.com/en-us/library/system.io.file.aspx
http://msdn.microsoft.com/en-us/library/system.io.directory.aspx
In addition to Adam's System.IO references take a look at Microsoft's OpenFileDialog component for an easy way to allow a user to open and close files.
http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx
You do need to use some Windows specific functionality and go to the Operating System for some of it.
Check out this CodeProject article: http://www.codeproject.com/KB/miscctrl/FileBrowser.aspx
The Shell Megapack controls will allow you to add a file/folder browsing controls in your apps.
Is that what you wanted?
精彩评论