从目录中撤回文件 [英] Retreving the files from directory

查看:86
本文介绍了从目录中撤回文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,



我试着写一堂课来调用这些文件。



< pre lang =vb> Dim all_files As [ String ]()= Directory.GetFiles(RootStorage)
Dim output = all_files。选择(Path.GetFileName)。Where( Function (one_file)one_file<> vs.bin)。ToArray()
返回输出





我收到错误,因为没有为'公共共享函数GetFileName(路径为字符串)作为字符串'的参数'path'指定参数。



请帮助

解决方案

嗯......错误信息非常明确。你需要为GetFileName方法提供一个字符串参数。

试试这个:

  Dim  output = all_files。选择功能(p)Path.GetFileName(p))。 Where( Function (one_file)one_file<>   vs.bin)。ToArray的()


Dear All,

I tried to invoke the files by writing a class.

Dim all_files As [String]() = Directory.GetFiles(RootStorage)
        Dim output = all_files.Select(Path.GetFileName).Where(Function(one_file) one_file <> "vs.bin").ToArray()
        Return output



I am getting the error as Argument not specified for parameter 'path' of 'Public Shared Function GetFileName(path As String) As String'.

Please help

解决方案

Well...the error message is pretty explicit. You need to provide a string parameter to the GetFileName method.
Try this:

Dim output = all_files.Select(Function(p) Path.GetFileName(p)).Where(Function(one_file) one_file <> "vs.bin").ToArray()


这篇关于从目录中撤回文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆