本文整理汇总了VB.NET中System.IO.FileSystemInfo类的典型用法代码示例。如果您正苦于以下问题:VB.NET FileSystemInfo类的具体用法?VB.NET FileSystemInfo怎么用?VB.NET FileSystemInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileSystemInfo类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: Module1
' 导入命名空间
Imports System.IO
Module Module1
Sub Main()
' Loop through all the immediate subdirectories of C.
For Each entry As String In Directory.GetDirectories("C:\")
DisplayFileSystemInfoAttributes(New DirectoryInfo(entry))
Next
' Loop through all the files in C.
For Each entry As String In Directory.GetFiles("C:\")
DisplayFileSystemInfoAttributes(New FileInfo(entry))
Next
End Sub
Sub DisplayFileSystemInfoAttributes(ByVal fsi As IO.FileSystemInfo)
' Assume that this entry is a file.
Dim entryType As String = "File"
' Determine if this entry is really a directory.
If (fsi.Attributes And FileAttributes.Directory) = FileAttributes.Directory Then
entryType = "Directory"
End If
' Show this entry's type, name, and creation date.
Console.WriteLine("{0} entry {1} was created on {2:D}", _
entryType, fsi.FullName, fsi.CreationTime)
End Sub
End Module
' Output will vary based on contents of drive C.
'
' Directory entry C:\Documents and Settings was created on Tuesday, November 25, 2003
' Directory entry C:\Inetpub was created on Monday, January 12, 2004
' Directory entry C:\Program Files was created on Tuesday, November 25, 2003
' Directory entry C:\RECYCLER was created on Tuesday, November 25, 2003
' Directory entry C:\System Volume Information was created on Tuesday, November 2, 2003
' Directory entry C:\WINDOWS was created on Tuesday, November 25, 2003
' File entry C:\IO.SYS was created on Tuesday, November 25, 2003
' File entry C:\MSDOS.SYS was created on Tuesday, November 25, 2003
' File entry C:\pagefile.sys was created on Saturday, December 27, 2003
开发者ID:VB.NET开发者,项目名称:System.IO,代码行数:42,代码来源:FileSystemInfo
注:本文中的System.IO.FileSystemInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论