相关疑难解决方法(0)

从目录中获取文件时排除某些文件扩展名

从目录中获取文件时如何排除某些文件类型?

我试过了

var files = Directory.GetFiles(jobDir);
Run Code Online (Sandbox Code Playgroud)

但似乎此功能只能选择要包含的文件类型,而不能排除.

c#

43
推荐指数
4
解决办法
6万
查看次数

如何浏览文件夹

我想设计一个包含浏览按钮的程序,我们可以浏览到所选文件夹并打开文件夹内的文件.

我需要一个参考和阅读,我可以解决我的问题?喜欢我应该使用什么方法/类.我不喜欢从MSDN上读书,因为我很难理解他们的理论.仅供参考我仍然是C#的初学者.

非常感谢你

P/s:这是我从互联网上找到的代码,您可以浏览/创建新文件夹.但我不知道为什么它使用Shell32.dll ..

private void button1_Click(object sender, EventArgs e)
{
    string strPath;
    string strCaption = "Select a Directory and folder.";
    DialogResult dlgResult;
    Shell32.ShellClass shl = new Shell32.ShellClass();
    Shell32.Folder2 fld = (Shell32.Folder2)shl.BrowseForFolder(0, strCaption, 0,
        System.Reflection.Missing.Value);
    if (fld == null)
    {
        dlgResult = DialogResult.Cancel;
    }
    else
    {
        strPath = fld.Self.Path;
        dlgResult = DialogResult.OK;
    }
}
Run Code Online (Sandbox Code Playgroud)

c# winforms

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×2

winforms ×1