- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
DirectoryNotFoundException in C#
If a directory you are trying to find does not exist, then DirectoryNotFoundException occurs.
Here, we are try to find a directory that does not exist using GetDirectories() method.
Example
using System.IO; using System; class Program { static void Main() { Directory.GetDirectories("D:\
ew\"); } }
The above code will generate the following exception since the directory “D:\
ew” does not exist.
Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path
Advertisements