Mega Code Archive

 
Categories / VB.Net / File Directory
 

Path Class performs operations on file or directory path

Imports System 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(Path.GetFullPath(path3))         Console.WriteLine(Path.GetTempPath())         Console.WriteLine(Path.GetTempFileName())     End Sub End Class