VB.Net by API/System.IO/FileSystemInfo — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 12:50, 26 мая 2010

FileSystemInfo.Attributes

  
Imports System.IO
public class Test
   public Shared Sub Main
        Dim strPath As String = "C:\Program Files"
        Dim objDI As New DirectoryInfo(strPath)
        Dim aryItemsInfo() As FileSystemInfo
        Dim objItem As FileSystemInfo
        aryItemsInfo = objDI.GetFileSystemInfos()
        For Each objItem In aryItemsInfo
            If objItem.Attributes And FileAttributes.Directory Then
                Console.WriteLine("FOLDER ")
            Else
                Console.WriteLine("FILE ")
            End If
            Console.WriteLine(objItem.Name)
        Next
   End Sub
End class


FileSystemInfo.Name

  
Imports System.IO
public class Test
   public Shared Sub Main
        Dim strPath As String = "C:\Program Files"
        Dim objDI As New DirectoryInfo(strPath)
        Dim aryItemsInfo() As FileSystemInfo
        Dim objItem As FileSystemInfo
        aryItemsInfo = objDI.GetFileSystemInfos()
        For Each objItem In aryItemsInfo
            If objItem.Attributes And FileAttributes.Directory Then
                Console.WriteLine("FOLDER ")
            Else
                Console.WriteLine("FILE ")
            End If
            Console.WriteLine(objItem.Name)
        Next
   End Sub
End class