0

我不知道系统在这一行的内存中存储了多少,For Each objFile in objFolder.Files以及使用类似的东西进行迭代是否objFile.Files.Count会更有益。有谁知道使用以下代码是否会产生任何重大的性能问题?

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
4

1 回答 1

0

我不知道系统在这行 For Each objFile in objFolder.Files 在内存中存储了多少

不知道你的意思,但这只会循环一个不会使用大量内存的 File对象的集合。如果这是您的问题,此调用显然不会加载内存中文件的内容。

于 2012-05-02T16:17:56.603 回答