现在的位置: 首页 > 综合 > 正文

Directory.GetFiles之searchPattern一问

2013年06月05日 ⁄ 综合 ⁄ 共 383字 ⁄ 字号 评论关闭

csdn .net blog 专家群

正确回答此问题说明您对Directory.GetFiles之中的searchPattern的使用有较深的认识。

假定在path之中有且仅有3个文件。其文件名分别是Blog.h, Blog.htm和Blog.html。试试看,您能不能正确得到下面3句指令的输出。

Console.WriteLine(System.IO.Directory.GetFiles(path, "Blog*.h").Length);
Console.WriteLine(System.IO.Directory.GetFiles(path, "Blog*.htm").Length);
Console.WriteLine(System.IO.Directory.GetFiles(path, "Blog*.html").Length);

在命令行下使用DIR命令可以得到相似的结果。

抱歉!评论已关闭.