ArrayList 元素
//目录条目类
public class FolderItem
{
public string filename;
public string filetype;
public int size;
public int number;
public FolderItem(string filename, string filetype, int size, int number)
{
this.filename = filename;
this.filetype = filetype;
this.size = size;
this.number = number;
} }
排序方法类
//目录上传时间排序
public class FolderItemCompare : IComparer
{
public int Compare(object manA, object manB)
{
FolderItem man1 = (FolderItem)manA;
FolderItem man2 = (FolderItem)manB;
return man1.number.CompareTo(man2.number);
}
}
调用:
ArrayList arrList = new ArrayList();
arrList.Add(item);
//...
arrList.Sort(new FolderItemCompare());