Check Drive Exists(string path)

前端 未结 8 944
半阙折子戏
半阙折子戏 2021-01-03 23:27

How to check the drive is exists in the system from the given string in WPF. I have tried the following

Ex: FileLocation.Text = \"K:\\TestDriv

相关标签:
8条回答
  • 2021-01-04 00:05

    you can try this....

    MessageBox.Show(Environment.SystemDirectory.Contains("D").ToString());
    
    0 讨论(0)
  • 2021-01-04 00:05

    This will get if any drives' letter is E. You can change it to any other letter.

    DriveInfo.GetDrives().Any(d => d.Name.ToUpper()[0] == 'E');
    
    0 讨论(0)
提交回复
热议问题