日期:2014-05-17 浏览次数:20856 次
public class FileA
{
public FileA(string fileName, DateTime createTime, long fileLength)
{
this.FileName = fileName;
this.CreateTime = createTime;
this.FileLength = fileLength;
}
public string FileName { get; set; }
public DateTime CreateTime { get; set; }
public long FileLength { get; set; }
}
private void Form1_Load(object sender, EventArgs e)
{
List<FileA> list = new List<FileA>();
string[] files = Directory.GetFiles(@"E:\zip\json\Bin\Net40");
foreach (string item in files)
{
FileInfo fileInfo = new FileInfo(item);
FileA file = new FileA(fileInfo.Name, fileInfo.CreationTime, fileInfo.Length);
list.Add(file);
}
list.ForEach(x => this.listView1.Items.Add(new ListViewItem(new string[] { x.FileName, x.CreateTime.ToString(), x.FileLength.ToString() })));
}