Imports System
Imports System.IO
Public Class Test
Public Shared Sub Main()
Dim di1 As DirectoryInfo = New DirectoryInfo("c:\MyDir")
Dim di2 As DirectoryInfo = New DirectoryInfo("c:\MyDir\temp")
Try
di1.Create()
di2.Create()
di1.Delete()
Catch e As Exception
Console.WriteLine("The Delete operation failed as expected.")
End Try
End Sub
End Class