偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

輕松打造VB.NET文件合并示例

開發(fā) 后端
VB.NET文件合并這一操作方法,在文件操作中是一個比較常見的操作。大家可以跟隨本文給出的代碼示例,進(jìn)行一番實踐編寫,加深對此的印象。

VB.NET編程語言在文件的操作方面體現(xiàn)了非常大的作用。比如今天要為大家介紹的VB.NET文件合并,就可以應(yīng)用VB.NET來輕松的實現(xiàn)。大家就一起來具體的解讀這段代碼來對此進(jìn)行一個詳細(xì)的了解。

VB.NET文件合并代碼實現(xiàn)示例:

  1. Private Sub MergeFiles(ByVal 
    inputDir As String, ByVal 
    inputMask As String, ByVal 
    outputPath As String)  
  2. 'store files in datatable 
    with their created times 
    to sort by later  
  3. Dim files As New DataTable  
  4. files.Columns.Add("filepath",
     GetType(String))  
  5. files.Columns.Add("creationtime",
     GetType(Date))  
  6. 'find partial files  
  7. For Each f As String In IO.
    Directory.GetFiles(inputDir, inputMask)  
  8. files.Rows.Add(New Object() 
    {f, IO.File.GetCreationTime(f)})  
  9. Next  
  10. 'make sure output file does
     not exist before writing  
  11. If IO.File.Exists(outputPath) Then  
  12. IO.File.Delete(outputPath)  
  13. End If  
  14. 'loop through file in order, 
    and append contents to output file  
  15. For Each dr As DataRow In 
    files.Select("", "creationtime")  
  16. Dim contents As String = 
    My.Computer.FileSystem.ReadAllText
    (CStr(dr("filepath")))  
  17. My.Computer.FileSystem.WriteAllText
    (outputPath, contents, True)  
  18. Next  
  19. End Su 

 VB.NET文件合并的相關(guān)實現(xiàn)方法就為大家介紹到這里。

【編輯推薦】

  1. VB.NET水晶報表優(yōu)點及結(jié)果描述
  2. VB.NET指針在實際應(yīng)用中作用體現(xiàn)
  3. VB.NET List實用技巧詳解
  4. VB.NET文件名排序輕松掌握
  5. VB.NET IEnumerator接口操作代碼解讀
責(zé)任編輯:曹凱 來源: 中國IT實驗室
相關(guān)推薦

2010-01-11 15:12:30

VB.NET特殊窗體

2009-10-29 15:02:04

VB.NET文件排序

2010-01-14 10:07:08

VB.NET文件名排序

2010-01-13 18:28:21

VB.NET歷史菜單

2009-10-27 16:18:58

VB.NET復(fù)制刪除文

2009-10-30 14:45:42

Flash控制VB.N

2010-01-14 13:59:01

2010-01-13 17:47:59

VB.NET拖放

2009-11-03 09:37:33

VB.NET重載

2010-01-18 15:01:02

VB.NET異常迭代捕

2010-01-18 19:36:52

VB.NET調(diào)整控件

2010-01-11 18:40:03

VB.NET操作注冊表

2009-10-29 16:36:49

VB.NET .DLL

2010-01-08 10:48:05

VB.NET多線程

2010-01-19 17:03:25

VB.NET可執(zhí)行語句

2010-01-14 13:08:37

VB.NET運(yùn)算符

2009-10-28 17:08:57

VB.NET數(shù)據(jù)庫開發(fā)

2009-10-29 15:16:02

VB.NET文件傳送

2009-11-02 12:35:10

VB.NET追加文件

2010-01-11 14:36:43

VB.NET安裝部署
點贊
收藏

51CTO技術(shù)棧公眾號