本文介绍了由FileInfo,DirectoryInfo持有的发布对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何释放下面这些功能所保存的对象?
How do i release respectively dispose the objects which are held from these fuctions below?
Dim drvInfo As DirectoryInfo = New DirectoryInfo("C:\myFolder")
Dim filesInfo() As FileInfo = drvInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly)
Try
For Each file As FileInfo In filesInfo
If Not file.Attributes = FileAttributes.System Then
My.Computer.FileSystem.RenameFile(file.FullName, "myFile" + file.Extension)
Next
Catch
End Try
推荐答案
这篇关于由FileInfo,DirectoryInfo持有的发布对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!