请教关于类数组提示“
未将对象引用设置到对象的实例”的问题
private void btDowload_Click(object sender, EventArgs e)
{
FTPclient ftpclient = new FTPclient();
FTPdirectory ftpdirectory = new FTPdirectory();//实例化一个FTPdirectory对象,因为
//ListDirectoryDetail函数的返回结果为FTPdirectory
string directory = "/AutoUpdate";
ftpdirectory = ftpclient.ListDirectoryDetail(directory);//读取AutoUpdate路径下的文件目录信息
########### FTPfileInfo[] fileInfoArray = new FTPfileInfo[ftpdirectory.Count];//建立一个类数组
for (int j = 0; j < ftpdirectory.Count; j++)
{
fileInfoArray[j] = new FTPfileInfo("");
}
ftpdirectory.CopyTo(fileInfoArray, 0);//将读取出来的FTPdirectory转化成刚刚建立的类数组
for (int i = 0; i < ftpdirectory.Count; i++)
{
if(cmbbFileList.Items[i.ToString()].Checked.Equals(true))
{
//FTPclient ftpclient = new FTPclient();
ftpclient.Username = "tech";
ftpclient.Password = "ULTRATEL";
ftpclient.Hostname = "ftpConnect";
string dirpath = "ftp://168.168.168.39/AutoUpdate/"+fileInfoArray[i].Filename;
ftpclient.FtpCreateDirectory(dirpath); //建立一个ftp的连接
ftpclient.Download(fileInfoArray[i].Filename, fileInfoArray[i].Filename, false);
}
}
}
这是我写的小程序 可是调试时在######处提示未将对象引用设置到对象的实例,不知道怎么解决。请各位大侠帮帮忙!!!!
------解决方案--------------------ftpdirectory = ftpclient.ListDirectoryDetail(directory);//读取AutoUpdate路径下的文件目录信息
这句没得到值吧
------解决方案--------------------断点调试看看
------解决方案--------------------ftpdirectory 看看它的构成 count是多少