按特定顺序将文件添加到List(String)

时间:2015-06-14 08:50:51

标签: vb.net

我在List(Of String)()的目录中添加了一个文件列表。我需要帮助将这些文件按特定顺序排列。例如,如果我在列表中有文件1,2,3,4,我怎么能把这些文件放到4,2,1,3命令中呢?

 Dim aryFi As FileInfo() = di.GetFiles("*.pdf")
 Dim fi As FileInfo

 Dim fileInput As New List(Of String)()

 For Each fi In aryFi
     fileInput.Add(fi.Name)
 Next

1 个答案:

答案 0 :(得分:1)

Dim fileInput As New List(Of String)

For Each fi as FileInfo in di.GetFiles("Sup-wrt.pdf")
    fileInput.Add(fi.Name)
Next
For Each fi as FileInfo in di.GetFiles("Invoice-*.pdf")
    fileInput.Add(fi.Name)
Next
For Each fi as FileInfo in di.GetFiles("Po-*.pdf")
    fileInput.Add(fi.Name)
Next