本文整理匯總了VB.NET中System.IO.Path類的典型用法代碼示例。如果您正苦於以下問題:VB.NET Path類的具體用法?VB.NET Path怎麽用?VB.NET Path使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Path類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Test
' 導入命名空間
Imports System.IO
Public Class Test
Public Shared Sub Main()
Dim path1 As String = "c:\temp\MyTest.txt"
Dim path2 As String = "c:\temp\MyTest"
Dim path3 As String = "temp"
If Path.HasExtension(path1) Then
Console.WriteLine("{0} has an extension.", path1)
End If
If Path.HasExtension(path2) = False Then
Console.WriteLine("{0} has no extension.", path2)
End If
If Path.IsPathRooted(path3) = False Then
Console.WriteLine("The string {0} contains no root information.", path3)
End If
Console.WriteLine("The full path of {0} is {1}.", path3, Path.GetFullPath(path3))
Console.WriteLine("{0} is the location for temporary files.", Path.GetTempPath())
Console.WriteLine("{0} is a file available for use.", Path.GetTempFileName())
' This code produces output similar to the following:
' c:\temp\MyTest.txt has an extension.
' c:\temp\MyTest has no extension.
' The string temp contains no root information.
' The full path of temp is D:\Documents and Settings\cliffc\My Documents\Visual Studio 2005\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\temp.
' D:\Documents and Settings\cliffc\Local Settings\Temp\8\ is the location for temporary files.
' D:\Documents and Settings\cliffc\Local Settings\Temp\8\tmp3D.tmp is a file available for use.
End Sub
End Class