且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在vb中删除主文件夹中的文件和文件夹?

更新时间:2022-11-17 16:15:53

VB:

VB:
Private Sub DeletFilesAndFolder()
	Dim path As String = "C:\Documents and Settings\prasad\Desktop\folder"

	If Directory.Exists(path) Then

		Directory.Delete(path, True)
	Else
		Console.WriteLine(path & " not exists")
	End If



End Sub





C#:



C#:

private void DeletFilesAndFolder()
       {
           string path = @"C:\Documents and Settings\prasad\Desktop\folder";

           if (Directory.Exists(path))

               Directory.Delete(path, true);
           else
               Console.WriteLine(path + " not exists");



       }