0
我不知道系統在此行的內存中存儲了多少For Each objFile in objFolder.Files
以及使用諸如objFile.Files.Count
之類的迭代是否更有利。有誰知道如果使用下面的代碼會造成任何重大的性能問題?通過FileSystemObject集合進行迭代時的性能調整
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'Get the folder object associated with the directory
Dim objFolder
Set objFolder = objFSO.GetFolder("C:\InetPub\wwwroot")
Response.Write "The files found in " & objFolder.Name & ":<br>"
'Loop through the Files collection
Dim objFile
For Each objFile in objFolder.Files
Response.Write objFile.Name & "<br>"
Next
'Clean up!
Set objFolder = Nothing
Set objFile = Nothing
Set objFSO = Nothing