允许用户在C#中浏览文件的最佳方法是什么?

Fre*_*red 6 c#

允许用户在C#中浏览文件的最佳方法是什么?

Rya*_*ley 16

using (OpenFileDialog dlg = new OpenFileDialog())
{
    dlg.Title = "Select a file";
    if (dlg.ShowDialog()== DialogResult.OK)
    {
        //do something with dlg.FileName  
    }
}
Run Code Online (Sandbox Code Playgroud)