使用C#DOT NET中的模块解析目录信息 [英] Parsing Directory Info using Module in C# DOT NET
本文介绍了使用C#DOT NET中的模块解析目录信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以通过以下方式帮助我。我试图解析文件夹和子文件夹。我尝试了几种方法,但没有运气。使用模块。但我收到以下错误。错误是值不能为空参数名称:path.Below是代码,任何人都可以告诉我我在哪里犯错误。
Can any one help me out with following. I am trying to parse the folders and sub folders.I tried several ways but no luck.Using the Module. But I am getting the following error.The error is Value cannot be null parameter name:path.Below is the code,can anyone tell me where i am making the mistake.
public struct Kbpathbase
{
public string project;
}
public static Module1.Kbpathbase kb;
=========在Crate新表单中,我已通过以下代码======= ===
=========In the Crate new form i have passed the following code ==========
private void parseProjects()
{
int i;
DirectoryInfo[] arrDirectoryInfo;
try
{
lv.Items.Clear();
DirectoryInfo directoryInfo1 = new DirectoryInfo(Module1.kb.project);
arrDirectoryInfo = directoryInfo1.GetDirectories();
i = 0;
while (i < arrDirectoryInfo.Length)
{
lv.Items.Add(arrDirectoryInfo[i].Name, 0);
i++;
}
}
catch (Exception exception1)
{
Interaction.MsgBox(exception1.Message, MsgBoxStyle.Critical, null);
Information.Err().Clear();
}
}
推荐答案
上次检查时,DirectoryInfo类是用'path' - 例如
Last time I checked, the DirectoryInfo class was constructed with a 'path' - eg
DirectoryInfo directoryInfo1 = new DirectoryInfo(@"C:\");
所以我不太确定你要用什么来实现
so Im not quite sure what you are trying to achieve with your
DirectoryInfo directoryInfo1 = new DirectoryInfo(Module1.kb.project);
这篇关于使用C#DOT NET中的模块解析目录信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文