DirectoryInfo.Delete deletes this DirectoryInfo if it is empty.
Imports System
Imports System.IO
Public Class Test
Public Shared Sub Main()
Dim di1 As DirectoryInfo = New DirectoryInfo("c:\MyDir")
Try
di1.Create()
di1.CreateSubdirectory("temp")
Console.WriteLine(di1.Name)
di1.Delete()
Catch
Console.WriteLine("The Delete operation was unsuccessful, as expected.")
End Try
End Sub
End Class