码迷,mamicode.com
首页 > Windows程序 > 详细

C# 读取文件目录下的所有的文件

时间:2015-06-30 10:17:28      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

DirectoryInfo 类

公开用于创建、移动和枚举目录和子目录的实例方法。无法继承此类。

Directory 类

公开用于创建、移动和枚举通过目录和子目录的静态方法。无法继承此类

一般使用directoryInfo类比较多

DirectoryInfo dInfo = new DirectoryInfo(“绝对路径”);//实例化一个DirectoryInfo的对象
//int index = 0;
foreach (FileInfo fInfo in dInfo.GetFiles())// dInfo.GetFiles()返回当前目录文件列表,fileInfo类型的一个数组
{

//遍历列表
float[] pos_descriptors;//正描述向量
using (Image<Bgr, Byte> img = new Image<Bgr, byte>(fInfo.FullName))
{
pos_descriptors = GetVector(img);
}
for (int i = 0; i < descriptorDim; i++)
{
sampleFeatureMat[index, i] = pos_descriptors[i];//第index个样本的特征向量中的第i个元素
}
//index++;
}

C# 读取文件目录下的所有的文件

标签:

原文地址:http://www.cnblogs.com/hartigen/p/4609550.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!