VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-program-to-show-the-use-of-exists-property/

⇱ C# Program to Show the Use of Exists Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# Program to Show the Use of Exists Property

Last Updated : 26 Jan, 2022

DirectoryInfo class provides different types of methods and properties for creating, moving, deleting, renaming, and modifying directories and subdirectories. Exists property is the property of DirectoryInfo class. This property is used to check whether a directory exists or not and return the boolean value accordingly. It will return true if the directory exists, otherwise, it will return false. It will also return if any error occurs while determining if the file exists, or if the specified file is missing, or if the caller does not get permission to read the specified file.

Syntax:

bool DirectoryInfo.Exists

Example:

Output:

Not Exists
Comment
Article Tags:
Article Tags:

Explore