C# Program to Show the Use of Exists Property Last Updated : 26 Jan, 2022 Comments Improve Suggest changes Like Article Like Report 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: C# // C# program to understande the use of Exists Property using System; using System.IO; class GFG{ static void Main() { // Getting the directory information DirectoryInfo information = new DirectoryInfo("sravan_directory"); // Checking whether the given directory // exists or not // Using Exists property if (information.Exists) Console.WriteLine("Exists"); else Console.WriteLine("Not Exists"); } } Output: Not Exists Comment More infoAdvertise with us Next Article C# Program to Demonstrate the Use of CanSeek Property S sravankumar_171fa07058 Follow Improve Article Tags : C# C# Programs Similar Reads C# Program to Demonstrate the Use of CanSeek Property FileStream class is used to perform read and write operations in a file. It provides full support for both synchronous and asynchronous read and write operations. This class provides different types of methods and properties and the CanSeek property is one of them. This property is used to find a va 2 min read C# Program to Check a Specified Type is a Pointer or not A pointer is a variable that contains the references of another variable. Or in other words, the pointer is a variable that stores the address of the same type of variable. For example, a string pointer can store the address of a string. In C#, we can able to check the given type is a pointer or not 2 min read C# Program to Check Given Directory Exists or not Given a directory, now our task is to check given directory exists or not. So to this task, we use the Exists() method of the Directory class. This method will return true if the given directory exists, otherwise false. Syntax: public static bool Exists (string? Mypath); Where, Mypath is a parameter 2 min read C Program to Show Unreachable Code Error Here, we will see how to show unreachable code errors using the C program. Unreachable statements are statements that will not be executed during the program execution. These statements may be unreachable due to the following reasons: Return statement before print statement.Infinite loop before stat 3 min read C Program to Compare Two Strings Using Pointers In C, two strings are generally compared character by character in lexicographical order (alphabetical order). In this article, we will learn how to compare two strings using pointers.To compare two strings using pointers, increment the pointers to traverse through each character of the strings whil 2 min read How to Check If a Table Exist in PL/SQL? In PL/SQL (Procedural Language/Structured Query Language), it's often necessary to determine whether a particular table exists in the database schema before attempting any operations on it. These views offer detailed metadata about database objects.This article explores methods and techniques to che 4 min read Like