title: Cast FileInfo into FileSystemInfo
body: <p>I am working on modifying file copy program that used to only copy a directory to another directory. Now I want to pass both directories and files in a list for the copy to run. </p>
  
  <pre><code>    For Each _fromPath In CopyList
          Dim FSinfo As FileSystemInfo()
          If Directory.Exists(_fromPath) Then
              Dim dir As New DirectoryInfo(_fromPath)
              FSinfo = dir.GetFileSystemInfos
          ElseIf File.Exists(_fromPath) Then
              Dim file As New FileInfo(_fromPath)
              FSinfo = file
          End If
  
          CountFiles(FSinfo)
  
      Next
  
      Private Function CountFiles(ByVal FSInfo As FileSystemInfo()) As Boolean
  </code></pre>
  
  <p>This code works fine for directories. In order to pass paths to the CountFiles, they must be in FileSystemInfo. Is there anyway to get FileInfo casted as a FileSystemInfo. </p>
  
  <p>I tried <code>CType(file, FileSystemInfo)</code> but it said <code>Value of type 'System.IO.FileInfo' cannot be converted to '1-dimensional array of System.IO.FileSystemInfo'.</code></p>