我正在制作一个文件夹列表,其中每个文件夹只需要几个属性,所以我使用下面的类。但是,无论是哪个文件夹,该FilesInFolder
属性总是比文件夹中的实际文件数多 5 个。
有人可以帮我找出问题所在吗?谢谢。
Public Class Single_Action_Folder
Public ReadOnly FullName As String = ""
Public ReadOnly Name As String = ""
Public ReadOnly FilesInFolder As Integer = 0
Public ReadOnly Exists As Boolean = False
'**
' Constructor
'*
Public Sub New(Optional dir As DirectoryInfo = Nothing)
' First check that a directory has been specified
If dir Is Nothing Then Exit Sub
' Populate the class properties
FullName = dir.FullName
Name = dir.Name
FilesInFolder = dir.GetFiles().Count
Exists = dir.Exists
End Sub
End Class